-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
73 lines (53 loc) · 1.77 KB
/
logger.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
package daemon
import "log"
type Logger interface {
Trace(args ...interface{})
Tracef(format string, args ...interface{})
Debug(args ...interface{})
Debugf(format string, args ...interface{})
Info(args ...interface{})
Infof(format string, args ...interface{})
Warn(args ...interface{})
Warnf(format string, args ...interface{})
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
}
type DefaultLog struct{}
func (l DefaultLog) Tracef(format string, args ...interface{}) {
log.Printf("[trace] "+format, args...)
}
func (l DefaultLog) Trace(args ...interface{}) {
log.Print(append([]interface{}{"[trace] "}, args...)...)
}
func (l DefaultLog) Debugf(format string, args ...interface{}) {
log.Printf("[debug] "+format, args...)
}
func (l DefaultLog) Debug(args ...interface{}) {
log.Print(append([]interface{}{"[debug] "}, args...)...)
}
func (l DefaultLog) Infof(format string, args ...interface{}) {
log.Printf("[info] "+format, args...)
}
func (l DefaultLog) Info(args ...interface{}) {
log.Print(append([]interface{}{"[info] "}, args...)...)
}
func (l DefaultLog) Warnf(format string, args ...interface{}) {
log.Printf("[warn] "+format, args...)
}
func (l DefaultLog) Warn(args ...interface{}) {
log.Print(append([]interface{}{"[warn] "}, args...)...)
}
func (l DefaultLog) Errorf(format string, args ...interface{}) {
log.Printf("[error] "+format, args...)
}
func (l DefaultLog) Error(args ...interface{}) {
log.Print(append([]interface{}{"[error] "}, args...)...)
}
func (l DefaultLog) Fatalf(format string, args ...interface{}) {
log.Printf("[fatal] "+format, args...)
}
func (l DefaultLog) Fatal(args ...interface{}) {
log.Print(append([]interface{}{"[fatal] "}, args...)...)
}