首次提交

This commit is contained in:
yangy
2026-05-21 15:20:12 +08:00
commit 3224041990
32 changed files with 1504 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package logger
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
func New(env string) (*zap.Logger, error) {
var cfg zap.Config
if env == "production" {
cfg = zap.NewProductionConfig()
cfg.EncoderConfig.TimeKey = "time"
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
} else {
cfg = zap.NewDevelopmentConfig()
cfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
}
return cfg.Build()
}