Fix linting
This commit is contained in:
		
							parent
							
								
									7cc8c81bd8
								
							
						
					
					
						commit
						b5158adb51
					
				
					 3 changed files with 10 additions and 11 deletions
				
			
		|  | @ -34,7 +34,7 @@ func newEvent() *Event { | ||||||
| // Fatal logs the event as FATAL, and exits the program with exit code 1 | // Fatal logs the event as FATAL, and exits the program with exit code 1 | ||||||
| func (e *Event) Fatal(message string, v ...any) { | func (e *Event) Fatal(message string, v ...any) { | ||||||
| 	e.Field("exit_code", 1).Log(FatalLevel, message, v...) | 	e.Field("exit_code", 1).Log(FatalLevel, message, v...) | ||||||
| 	fmt.Fprintf(os.Stderr, fmt.Sprintf(message+"\n", v...)) // Always output error to stderr | 	fmt.Fprintf(os.Stderr, message+"\n", v...) // Always output error to stderr | ||||||
| 	os.Exit(1) | 	os.Exit(1) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								log/log.go
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								log/log.go
									
										
									
									
									
								
							|  | @ -8,21 +8,19 @@ import ( | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const ( | // Defaults for package level variables | ||||||
|  | var ( | ||||||
| 	DefaultLevel  = InfoLevel | 	DefaultLevel  = InfoLevel | ||||||
| 	DefaultFormat = TextFormat | 	DefaultFormat = TextFormat | ||||||
|  | 	DefaultOutput = os.Stderr | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var ( | var ( | ||||||
| 	level               = DefaultLevel | 	level               = DefaultLevel | ||||||
| 	format              = DefaultFormat | 	format              = DefaultFormat | ||||||
| 	overrides           = make(map[string]*levelOverride) | 	overrides           = make(map[string]*levelOverride) | ||||||
| 	mu        = &sync.Mutex{} |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| var ( |  | ||||||
| 	DefaultOutput           = os.Stderr |  | ||||||
| 	output    io.Writer = DefaultOutput | 	output    io.Writer = DefaultOutput | ||||||
|  | 	mu                  = &sync.Mutex{} | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Fatal prints the given message, and exits the program | // Fatal prints the given message, and exits the program | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ func (l Level) String() string { | ||||||
| 	return "unknown" | 	return "unknown" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // MarshalJSON converts a level to a JSON string | ||||||
| func (l Level) MarshalJSON() ([]byte, error) { | func (l Level) MarshalJSON() ([]byte, error) { | ||||||
| 	return json.Marshal(l.String()) | 	return json.Marshal(l.String()) | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue