logger: slog logger #266

Merged
vtolstov merged 5 commits from slog into master 2023-10-14 18:05:47 +03:00
Showing only changes of commit fd471a89e2 - Show all commits

View File

@ -103,12 +103,6 @@ func (s *slogLogger) Log(ctx context.Context, lvl Level, args ...any) {
log.Fatalln(msg, attr) log.Fatalln(msg, attr)
} }
if slvl == slog.LevelError {
l := s.slog.With(slog.Any("ProcStatus", "ERROR"), slog.Any("ErrorText", msg))
l.LogAttrs(ctx, slvl, "", attr...)
return
}
s.slog.LogAttrs(ctx, slvl, msg, attr...) s.slog.LogAttrs(ctx, slvl, msg, attr...)
} }
@ -125,12 +119,6 @@ func (s *slogLogger) Logf(ctx context.Context, lvl Level, format string, args ..
log.Fatalln(msg, attr) log.Fatalln(msg, attr)
} }
if slvl == slog.LevelError {
l := s.slog.With(slog.Any("ProcStatus", "ERROR"), slog.Any("ErrorText", msg))
l.LogAttrs(ctx, slvl, "", attr...)
return
}
s.slog.LogAttrs(ctx, slvl, msg, attr...) s.slog.LogAttrs(ctx, slvl, msg, attr...)
} }
@ -229,9 +217,6 @@ func renameTime(groups []string, a slog.Attr) slog.Attr {
if a.Key == slog.TimeKey { if a.Key == slog.TimeKey {
a.Key = "@timestamp" a.Key = "@timestamp"
} }
if a.Key == slog.MessageKey {
a.Key = "message"
}
return a return a
} }