func()

in encoder_config.go [89:124]


func (cfg EncoderConfig) ToZapCoreEncoderConfig() zapcore.EncoderConfig {
	encCfg := zapcore.EncoderConfig{
		MessageKey:     messageKey,
		LevelKey:       logLevelKey,
		TimeKey:        timeKey,
		EncodeTime:     encodeTime,
		LineEnding:     cfg.LineEnding,
		EncodeDuration: cfg.EncodeDuration,
		EncodeName:     cfg.EncodeName,
		EncodeLevel:    cfg.EncodeLevel,
	}
	if encCfg.EncodeDuration == nil {
		encCfg.EncodeDuration = defaultEncodeDuration
	}
	if cfg.EnableName {
		encCfg.NameKey = logNameKey
		if encCfg.EncodeName == nil {
			encCfg.EncodeName = defaultEncodeName
		}
	}
	if cfg.EnableStackTrace {
		encCfg.StacktraceKey = stackTraceKey
	}
	if cfg.EnableCaller {
		encCfg.CallerKey = callerKey
		if cfg.EncodeCaller == nil {
			encCfg.EncodeCaller = defaultEncodeCaller
		} else {
			encCfg.EncodeCaller = zapcore.CallerEncoder(cfg.EncodeCaller)
		}
	}
	if encCfg.EncodeLevel == nil {
		encCfg.EncodeLevel = defaultEncodeLevel
	}
	return encCfg
}