add initial application structure with configuration, logging, and health check endpoints
This commit is contained in:
@@ -15,9 +15,21 @@ func NewLogger(cfg *config.Config) (*zap.Logger, error) {
|
||||
|
||||
zapCfg := zap.NewProductionConfig()
|
||||
zapCfg.Level = zap.NewAtomicLevelAt(level)
|
||||
zapCfg.EncoderConfig.CallerKey = "caller"
|
||||
zapCfg.EncoderConfig.StacktraceKey = "stacktrace"
|
||||
if cfg.Log.Format == "console" {
|
||||
zapCfg.Encoding = "console"
|
||||
devCfg := zap.NewDevelopmentConfig()
|
||||
devCfg.Level = zap.NewAtomicLevelAt(level)
|
||||
devCfg.EncoderConfig.CallerKey = "caller"
|
||||
devCfg.EncoderConfig.StacktraceKey = "stacktrace"
|
||||
return devCfg.Build(
|
||||
zap.AddCaller(),
|
||||
zap.AddStacktrace(zapcore.ErrorLevel),
|
||||
)
|
||||
}
|
||||
|
||||
return zapCfg.Build()
|
||||
return zapCfg.Build(
|
||||
zap.AddCaller(),
|
||||
zap.AddStacktrace(zapcore.ErrorLevel),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user