logger: add log level aliases
This commit is contained in:
parent
bc82c8b59c
commit
60d9fde890
@ -25,6 +25,15 @@ var defaultLogger slog.Logger // nolint: gochecknoglobals
|
|||||||
|
|
||||||
type Field = slog.Field
|
type Field = slog.Field
|
||||||
type Map = slog.Map
|
type Map = slog.Map
|
||||||
|
type Level = slog.Level
|
||||||
|
|
||||||
|
const (
|
||||||
|
LevelCritical Level = slog.LevelCritical
|
||||||
|
LevelError Level = slog.LevelError
|
||||||
|
LevelWarn Level = slog.LevelWarn
|
||||||
|
LevelInfo Level = slog.LevelInfo
|
||||||
|
LevelDebug Level = slog.LevelDebug
|
||||||
|
)
|
||||||
|
|
||||||
func init() { // nolint: gochecknoinits
|
func init() { // nolint: gochecknoinits
|
||||||
defaultLogger = Make(FormatHuman, os.Stdout)
|
defaultLogger = Make(FormatHuman, os.Stdout)
|
||||||
@ -87,6 +96,6 @@ func E(err error) Field {
|
|||||||
return slog.Error(err)
|
return slog.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetLevel(level slog.Level) {
|
func SetLevel(level Level) {
|
||||||
defaultLogger = defaultLogger.Leveled(level)
|
defaultLogger = defaultLogger.Leveled(level)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user