fix: default to debug if no config is passed, we will then error on config parsing after

This commit is contained in:
Derrick Hammer 2024-03-10 13:02:31 -04:00
parent 39a39b00b7
commit b6683a5744
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 2 deletions

View File

@ -14,8 +14,12 @@ func NewLogger(cm *config.Manager) (*zap.Logger, *zap.AtomicLevel) {
// Create a new atomic level // Create a new atomic level
atomicLevel := zap.NewAtomicLevel() atomicLevel := zap.NewAtomicLevel()
if cm != nil {
// Set initial log level, for example, info level // Set initial log level, for example, info level
atomicLevel.SetLevel(mapLogLevel(cm.Config().Core.Log.Level)) atomicLevel.SetLevel(mapLogLevel(cm.Config().Core.Log.Level))
} else {
atomicLevel.SetLevel(mapLogLevel("debug"))
}
// Create the logger with the atomic level // Create the logger with the atomic level
logger := zap.New(zapcore.NewCore( logger := zap.New(zapcore.NewCore(