func New()

in utils/log/logger.go [45:79]


func New(c Config, fields map[string]interface{}) (*zap.Logger, error) {
	c = c.applyDefaults()
	if c.Disable {
		return zap.NewNop(), nil
	}
	if fields == nil {
		fields = map[string]interface{}{}
	}
	if c.ServiceName != "" {
		fields["service_name"] = c.ServiceName
	}

	return zap.Config{
		Level: zap.NewAtomicLevelAt(c.Level),
		Sampling: &zap.SamplingConfig{
			Initial:    100,
			Thereafter: 100,
		},
		Encoding: c.Encoding,
		EncoderConfig: zapcore.EncoderConfig{
			MessageKey:     "message",
			NameKey:        "logger_name",
			LevelKey:       "level",
			TimeKey:        "ts",
			CallerKey:      "caller",
			EncodeLevel:    zapcore.CapitalLevelEncoder,
			EncodeTime:     c.EncodeTime,
			EncodeDuration: zapcore.SecondsDurationEncoder,
			EncodeCaller:   zapcore.ShortCallerEncoder,
		},
		DisableStacktrace: true,
		OutputPaths:       []string{c.Path},
		InitialFields:     fields,
	}.Build()
}