| | |
| | | |
| | | func init() { |
| | | Log = NewLogger() |
| | | Log.SetLevel(logrus.ErrorLevel) |
| | | } |
| | | |
| | | func NewLogger() *logrus.Logger { |
| | |
| | | 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() |