Skip to content

Commit

Permalink
Added method for get *slog.Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
eliofery committed May 11, 2024
1 parent 71d1d20 commit 8d7628b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit 8d7628b

Please sign in to comment.