go get -u go.kuoruan.net/log
Use the global
logger.
package main
import "go.kuoruan.net/log"
func main() {
log.SetOptions(log.Development())
log.Debug("this is debug log")
}
Or create new:
package main
import "go.kuoruan.net/log"
func main() {
logger := log.New(
log.RotationConfig{
MaxSize: 500, // MB
MaxAge: 3, // days
MaxBackups: 7,
LocalTime: true,
Compress: true,
},
log.AddCaller(),
log.WithLogDirs("log"),
log.LogToStdout(),
)
logger.Info("This is info log")
}