-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJLog.go
More file actions
42 lines (33 loc) · 792 Bytes
/
JLog.go
File metadata and controls
42 lines (33 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package toolset
import (
"github.com/sirupsen/logrus"
"gopkg.in/natefinch/lumberjack.v2"
)
var log = logrus.New()
func InitLog(logPath string) {
log.SetOutput(&lumberjack.Logger{
Filename: logPath, // 日志文件路径
MaxSize: 10, // 文件最大大小(MB)
MaxBackups: 3, // 保留旧文件的最大个数
MaxAge: 28, // 保留旧文件的最大天数
Compress: true, // 是否压缩/归档旧文件
})
}
func Info(args ...interface{}) {
log.Info(args...)
}
func Error(args ...interface{}) {
log.Error(args...)
}
func Debug(args ...interface{}) {
log.Debug(args...)
}
func Print(args ...interface{}) {
log.Print(args...)
}
func Trace(args ...interface{}) {
log.Trace(args...)
}
func Warn(args ...interface{}) {
log.Warn(args...)
}