Below code for rotation logs:

```
package main

import (
    "os"

    "go.uber.org/zap"
    "go.uber.org/zap/zapcore"
    lumberjack "gopkg.in/natefinch/lumberjack.v2"
)

func main() {
    logPath, _ := os.Getwd()
    log := NewLoggerFp(logPath, 1, 2, 2)

    log.Infof("sjkshfjsdf\n")
    log.Infof("sjkshfjsdf\n")
    log.Infof("sjkshfjsdf\n")
}

func NewLoggerFp(logPath string, maxSize, maxBackUp, maxAge int) *zap.SugaredLogger {

    w := zapcore.AddSync(&lumberjack.Logger{

        Filename:   logPath + "/dump.log",
        MaxSize:    maxSize, // megabytes
        MaxBackups: maxBackUp,
        MaxAge:     maxAge, // days
    })

    core := zapcore.NewCore(
        zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()),
        w,
        zap.InfoLevel,
    )

    return zap.New(core).Sugar()
}

```

---

Logs get created
How to add timestamp to `dump.log`?