logger: add missing slog shortcut aliases

This commit is contained in:
wpetit 2020-03-17 13:20:06 +01:00
parent 682d70ed30
commit bc82c8b59c
1 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,7 @@ const (
var defaultLogger slog.Logger // nolint: gochecknoglobals
type Field = slog.Field
type Map = slog.Map
func init() { // nolint: gochecknoinits
defaultLogger = Make(FormatHuman, os.Stdout)
@ -78,8 +79,12 @@ func F(name string, value interface{}) Field {
return slog.F(name, value)
}
func SetFormat(f Format) {
defaultLogger = Make(f, os.Stdout)
func M(fields ...Field) Map {
return slog.M(fields...)
}
func E(err error) Field {
return slog.Error(err)
}
func SetLevel(level slog.Level) {