mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-05-10 06:18:11 +00:00
refactor: use one struct for context handling and cancellation
This commit is contained in:
@@ -77,7 +77,6 @@ func (l *Logger) WithWriter(writer io.Writer) *Logger {
|
||||
func (l *Logger) Init() {
|
||||
base := log.With().
|
||||
Timestamp().
|
||||
Caller().
|
||||
Logger().
|
||||
Level(l.parseLogLevel(l.config.Level)).Output(l.writer)
|
||||
|
||||
@@ -114,6 +113,9 @@ func (l *Logger) createLogger(component string, cfg model.LogStreamConfig) zerol
|
||||
if cfg.Level != "" {
|
||||
sub = sub.Level(l.parseLogLevel(cfg.Level))
|
||||
}
|
||||
if sub.GetLevel() == zerolog.DebugLevel {
|
||||
sub = sub.With().Caller().Logger()
|
||||
}
|
||||
return sub
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user