创建log,启用hook,增加log按日期文件切分,自动删除旧日志,记录行号等功能
import(
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
log "github.com/sirupsen/logrus"
)
func initLog() {
path := "./log/screen-monitor.log"
vars.Logger = log.New()
vars.Logger.Hooks.Add(log_hooks.NewContextHook())