-
Notifications
You must be signed in to change notification settings - Fork 3
/
logrus.go
79 lines (61 loc) · 1.5 KB
/
logrus.go
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package loggo
import (
"github.com/sirupsen/logrus"
"io"
)
func NewLogrusLog(level string, output io.Writer) Log {
logrus.SetFormatter(&logrus.JSONFormatter{})
logrus.SetReportCaller(true)
defaultLevel := logrus.InfoLevel
lv, err := logrus.ParseLevel(level)
if err != nil {
logrus.SetLevel(defaultLevel)
logrus.Warn("logrus level error :", err)
}
logrus.SetOutput(output)
logrus.SetLevel(lv)
return new(logrusLog)
}
type logrusLog struct{}
func (l *logrusLog) Print(v ...interface{}) {
logrus.Print(v...)
}
func (l *logrusLog) Println(v ...interface{}) {
logrus.Println(v...)
}
func (l *logrusLog) Debug(v ...interface{}) {
logrus.Debug(v...)
}
func (l *logrusLog) Debugf(msg string, v ...interface{}) {
logrus.Debugf(msg, v...)
}
func (l *logrusLog) Info(v ...interface{}) {
logrus.Info(v...)
}
func (l *logrusLog) Infof(msg string, v ...interface{}) {
logrus.Infof(msg, v...)
}
func (l *logrusLog) Warn(v ...interface{}) {
logrus.Warn(v...)
}
func (l *logrusLog) Warnf(msg string, v ...interface{}) {
logrus.Warnf(msg, v...)
}
func (l *logrusLog) Error(v ...interface{}) {
logrus.Error(v...)
}
func (l *logrusLog) Errorf(msg string, v ...interface{}) {
logrus.Errorf(msg, v...)
}
func (l *logrusLog) Panic(v ...interface{}) {
logrus.Panic(v...)
}
func (l *logrusLog) Panicf(msg string, v ...interface{}) {
logrus.Panicf(msg, v...)
}
func (l *logrusLog) Fatal(v ...interface{}) {
logrus.Fatal(v...)
}
func (l *logrusLog) Fatalf(msg string, v ...interface{}) {
logrus.Fatalf(msg, v...)
}