From 1cbc353479d1d6f0625b94cfbb03d75ab8c5322e Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 4 Mar 2024 22:22:05 +0300 Subject: [PATCH] logger: fixes Signed-off-by: Vasiliy Tolstov --- logger/noop.go | 4 ++++ logger/slog/slog.go | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/logger/noop.go b/logger/noop.go index e59f932f..f2c40057 100644 --- a/logger/noop.go +++ b/logger/noop.go @@ -45,6 +45,10 @@ func (l *noopLogger) Options() Options { return l.opts } +func (l *noopLogger) Name() string { + return l.opts.Name +} + func (l *noopLogger) String() string { return "noop" } diff --git a/logger/slog/slog.go b/logger/slog/slog.go index eca419b4..cd9155c2 100644 --- a/logger/slog/slog.go +++ b/logger/slog/slog.go @@ -113,7 +113,7 @@ func (s *slogLogger) Attrs(attrs ...interface{}) logger.Logger { handleOpt := &slog.HandlerOptions{ ReplaceAttr: nl.renameAttr, - Level: s.leveler, + Level: nl.leveler, AddSource: true, } @@ -261,6 +261,10 @@ func (s *slogLogger) Warn(ctx context.Context, msg string, attrs ...interface{}) _ = s.slog.Handler().Handle(ctx, r) } +func (s *slogLogger) Name() string { + return s.opts.Name +} + func (s *slogLogger) String() string { return "slog" }