zap.go 373 B

123456789101112131415
  1. package logging
  2. import (
  3. "go.uber.org/zap"
  4. "go.uber.org/zap/zapcore"
  5. )
  6. func NewZapLogger() (*zap.Logger, error) {
  7. zapCfg := zap.NewDevelopmentConfig()
  8. zapCfg.DisableStacktrace = true
  9. zapCfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
  10. zapCfg.EncoderConfig.EncodeTime = zapcore.TimeEncoderOfLayout("2006/01/02 15:04:05.000")
  11. return zapCfg.Build()
  12. }