diff --git a/backend/mpc-system/pkg/logger/logger.go b/backend/mpc-system/pkg/logger/logger.go index cbcb8402..eea1adee 100644 --- a/backend/mpc-system/pkg/logger/logger.go +++ b/backend/mpc-system/pkg/logger/logger.go @@ -1,8 +1,6 @@ package logger import ( - "os" - "go.uber.org/zap" "go.uber.org/zap/zapcore" ) @@ -70,6 +68,10 @@ func Init(cfg *Config) error { } Sugar = Log.Sugar() + + // Replace global zap logger to ensure our config takes effect + zap.ReplaceGlobals(Log) + return nil } @@ -158,12 +160,14 @@ func Err(err error) zap.Field { return zap.Error(err) } -func init() { - // Initialize with development logger by default - // This will be overridden when Init() is called with proper config - if os.Getenv("ENV") == "production" { - _ = InitProduction() - } else { - _ = InitDevelopment() - } -} +// Removed init() function to prevent it from overriding logger config. +// The logger will be initialized when Init() is explicitly called with config. +// func init() { +// // Initialize with development logger by default +// // This will be overridden when Init() is called with proper config +// if os.Getenv("ENV") == "production" { +// _ = InitProduction() +// } else { +// _ = InitDevelopment() +// } +// }