Skip to content

Commit

Permalink
Fix log level pass to common lib. Fix level set on the logger
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-abtasty committed Aug 25, 2022
1 parent 26aa20e commit e7df3bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func CreateServer(envID string, apiKey string, addr string, opts ...ServerOption
}

// set the logger for common package
commonLogger := logger.New(config.LoggerLevel, config.LoggerFormat, "common")
commonLogger := logger.New(serverOptions.logger.Level.String(), config.LoggerFormat, "common")
common.SetLogger(&common.DefaultLogger{
Entry: commonLogger.Entry,
})
Expand Down
4 changes: 3 additions & 1 deletion pkg/utils/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func New(lvl string, fmt LogFormat, component string) *Logger {
} else {
l.SetLevel(parsedLvl)
}
entry := l.WithField("component", component)
entry.Level = parsedLvl

return &Logger{l.WithField("component", component)}
return &Logger{entry}
}

0 comments on commit e7df3bd

Please sign in to comment.