// NewZapLogger creates a new ZapLogger.
NewZapLogger creates a new ZapLogger.
// NewZapLogger creates a new ZapLogger .
func NewZapLogger(opt *Option) (*ZapLogger, error) {
	filepath := fmt.Sprintf("%s/%s.log", strings.TrimRight(opt.Path, "/"), opt.Filename)
	cfg := zap.NewProductionConfig()
	cfg.OutputPaths = []string{filepath}
	cfg.EncoderConfig.TimeKey = "time"
	cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
	logger, err := cfg.Build(
		zap.AddCaller(),
		zap.AddStacktrace(zapcore.WarnLevel),
		zap.AddCallerSkip(3),
	)
	if err != nil {
		return nil, err
	}
	return &ZapLogger{
		zap:   logger,
		sugar: logger.Sugar(),
	}, nil
}
func NewZapLogger ( opt * Option ) ( * ZapLogger , error ) { filepath := fmt . Sprintf ( " " , strings . TrimRight ( opt . Path , " " ) , opt . Filename ) cfg := zap . NewProductionConfig ( ) cfg . OutputPaths = [ ] string { filepath } cfg . EncoderConfig . TimeKey = " " cfg . EncoderConfig . EncodeTime = zapcore . ISO8601TimeEncoder logger , err := cfg . Build ( zap . AddCaller ( ) , zap . AddStacktrace ( zapcore . WarnLevel ) , zap . AddCallerSkip ( 3 ) , ) if err != nil { return nil , err } return & ZapLogger { zap : logger , sugar : logger . Sugar ( ) , } , nil }
NewZapLogger creates a new ZapLogger.
NewZapLogger creates a new ZapLogger .