refactor: use one struct for context handling and cancellation

This commit is contained in:
Stavros
2026-05-07 22:31:51 +03:00
parent cc357f35ef
commit 592c221b2d
7 changed files with 327 additions and 210 deletions
+3 -1
View File
@@ -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
}