logger: add missing slog shortcut aliases
This commit is contained in:
parent
682d70ed30
commit
bc82c8b59c
@ -24,6 +24,7 @@ const (
|
|||||||
var defaultLogger slog.Logger // nolint: gochecknoglobals
|
var defaultLogger slog.Logger // nolint: gochecknoglobals
|
||||||
|
|
||||||
type Field = slog.Field
|
type Field = slog.Field
|
||||||
|
type Map = slog.Map
|
||||||
|
|
||||||
func init() { // nolint: gochecknoinits
|
func init() { // nolint: gochecknoinits
|
||||||
defaultLogger = Make(FormatHuman, os.Stdout)
|
defaultLogger = Make(FormatHuman, os.Stdout)
|
||||||
@ -78,8 +79,12 @@ func F(name string, value interface{}) Field {
|
|||||||
return slog.F(name, value)
|
return slog.F(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetFormat(f Format) {
|
func M(fields ...Field) Map {
|
||||||
defaultLogger = Make(f, os.Stdout)
|
return slog.M(fields...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func E(err error) Field {
|
||||||
|
return slog.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetLevel(level slog.Level) {
|
func SetLevel(level slog.Level) {
|
||||||
|
Loading…
Reference in New Issue
Block a user