From 8d7628b7ac210b3dba24730e9398e60fd187fad9 Mon Sep 17 00:00:00 2001 From: Sergey Erofeev Date: Sat, 11 May 2024 17:22:41 +0500 Subject: [PATCH] Added method for get *slog.Logger --- logger.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/logger.go b/logger.go index 54b3679..8f8a1a4 100644 --- a/logger.go +++ b/logger.go @@ -73,6 +73,9 @@ type Logger interface { // Printerer is an interface for printing messages. Printerer + + // Slogger returns the underlying [slog.Logger]. + Slogger() *slog.Logger } // logger represents a structure that implements the [Logger] interface. @@ -93,6 +96,11 @@ func New(handler slog.Handler, lvl *slog.LevelVar) Logger { } } +// Slogger returns the underlying [slog.Logger]. +func (l *logger) Slogger() *slog.Logger { + return l.logger +} + // SetLevel sets the logging level. func (l *logger) SetLevel(level slog.Level) { l.level.Set(level)