DelayNoMore/battle_srv/common/logger.go
2022-09-20 23:52:55 +08:00

24 lines
491 B
Go

package common
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var Logger *zap.Logger
var LoggerConfig zap.Config
func init() {
LoggerConfig = zap.NewDevelopmentConfig()
LoggerConfig.Level.SetLevel(zap.InfoLevel)
LoggerConfig.Development = false
LoggerConfig.Sampling = &zap.SamplingConfig{
Initial: 100,
Thereafter: 100,
}
LoggerConfig.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
var err error
Logger, err = LoggerConfig.Build()
ErrFatal(err)
}