Fix linting

This commit is contained in:
binwiederhier 2023-02-05 23:53:24 -05:00
parent 7cc8c81bd8
commit b5158adb51
3 changed files with 10 additions and 11 deletions

View file

@ -34,7 +34,7 @@ func newEvent() *Event {
// Fatal logs the event as FATAL, and exits the program with exit code 1
func (e *Event) Fatal(message string, v ...any) {
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)
}

View file

@ -8,21 +8,19 @@ import (
"time"
)
const (
// Defaults for package level variables
var (
DefaultLevel = InfoLevel
DefaultFormat = TextFormat
DefaultOutput = os.Stderr
)
var (
level = DefaultLevel
format = DefaultFormat
overrides = make(map[string]*levelOverride)
mu = &sync.Mutex{}
)
var (
DefaultOutput = os.Stderr
output io.Writer = DefaultOutput
mu = &sync.Mutex{}
)
// Fatal prints the given message, and exits the program

View file

@ -36,6 +36,7 @@ func (l Level) String() string {
return "unknown"
}
// MarshalJSON converts a level to a JSON string
func (l Level) MarshalJSON() ([]byte, error) {
return json.Marshal(l.String())
}