-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathentry.go
47 lines (36 loc) · 998 Bytes
/
entry.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
package caption_json_formatter
import (
"fmt"
"github.com/sirupsen/logrus"
)
type Entry struct {
*logrus.Entry
}
func (entry *Entry) Trace(args ...interface{}) {
entry.printLog(logrus.TraceLevel, args...)
}
func (entry *Entry) Debug(args ...interface{}) {
entry.printLog(logrus.DebugLevel, args...)
}
func (entry *Entry) Info(args ...interface{}) {
entry.printLog(logrus.InfoLevel, args...)
}
func (entry *Entry) Warn(args ...interface{}) {
entry.printLog(logrus.WarnLevel, args...)
}
func (entry *Entry) Error(args ...interface{}) {
entry.printLog(logrus.ErrorLevel, args...)
}
func (entry *Entry) Fatal(args ...interface{}) {
entry.printLog(logrus.FatalLevel, args...)
}
func (entry *Entry) Panic(args ...interface{}) {
entry.printLog(logrus.PanicLevel, args...)
}
func (entry *Entry) printLog(level logrus.Level, args ...interface{}) {
datas := make([]interface{}, len(args))
for i, v := range args {
datas[i] = Stringify(v)
}
entry.Log(level, fmt.Sprint(datas...))
}