From a27f1d9078dba3b11f0a3c1e536a2f98b64d250d Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 30 五月 2019 10:49:02 +0800 Subject: [PATCH] change time to [-60s,-40s] --- log/log.go | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/log/log.go b/log/log.go index f1b7b12..e5ca557 100644 --- a/log/log.go +++ b/log/log.go @@ -13,6 +13,7 @@ func init() { Log = NewLogger() + Log.SetLevel(logrus.ErrorLevel) } func NewLogger() *logrus.Logger { @@ -20,19 +21,20 @@ return Log } - infopath := "log/info.log" + infopath := "logs/info.log" infowriter, _ := rotatelogs.New( infopath+".%Y%m%d%H%M", rotatelogs.WithLinkName(infopath), - rotatelogs.WithMaxAge(time.Duration(86400)*time.Second), - rotatelogs.WithRotationTime(time.Duration(604800)*time.Second), + rotatelogs.WithMaxAge(30*24*time.Hour), + rotatelogs.WithRotationTime(24*time.Hour), ) - errorpath := "log/error.log" + + errorpath := "logs/error.log" errorwriter, _ := rotatelogs.New( errorpath+".%Y%m%d%H%M", rotatelogs.WithLinkName(errorpath), - rotatelogs.WithMaxAge(time.Duration(86400)*time.Second), - rotatelogs.WithRotationTime(time.Duration(604800)*time.Second), + rotatelogs.WithMaxAge(30*24*time.Hour), + rotatelogs.WithRotationTime(24*time.Hour), ) Log = logrus.New() -- Gitblit v1.8.0