mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-22 17:52:30 +01:00
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
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
18
log/log.go
18
log/log.go
|
@ -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
|
||||
level = DefaultLevel
|
||||
format = DefaultFormat
|
||||
overrides = make(map[string]*levelOverride)
|
||||
output io.Writer = DefaultOutput
|
||||
mu = &sync.Mutex{}
|
||||
)
|
||||
|
||||
// Fatal prints the given message, and exits the program
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue