-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlogger.go
104 lines (91 loc) · 2.48 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package outbox
import (
"context"
"log"
)
// Logger logger
type Logger interface {
// Debugf 测试
Debugf(ctx context.Context, format string, args ...interface{})
// Debugln 测试
Debugln(ctx context.Context, args ...interface{})
// Infof 信息
Infof(ctx context.Context, format string, args ...interface{})
// Infoln 消息
Infoln(ctx context.Context, args ...interface{})
// Warnf 警告
Warnf(ctx context.Context, format string, args ...interface{})
// Warnln 警告
Warnln(ctx context.Context, args ...interface{})
// Warningf 警告
Warningf(ctx context.Context, format string, args ...interface{})
// Warningln 警告
Warningln(ctx context.Context, args ...interface{})
// Errorf 错误
Errorf(ctx context.Context, format string, args ...interface{})
// Errorln 错误
Errorln(ctx context.Context, args ...interface{})
}
// StdLogger ...
type StdLogger struct {
}
// Debugf 测试
func (StdLogger) Debugf(ctx context.Context, format string, args ...interface{}) {
log.Printf("[Debug] "+format, args...)
}
// Debugln 测试
func (StdLogger) Debugln(ctx context.Context, args ...interface{}) {
nArgs := []interface{}{
"[Debug]",
}
nArgs = append(nArgs, args...)
log.Println(nArgs...)
}
// Infof 信息
func (StdLogger) Infof(ctx context.Context, format string, args ...interface{}) {
log.Printf("[INFO] "+format, args...)
}
// Infoln 消息
func (StdLogger) Infoln(ctx context.Context, args ...interface{}) {
nArgs := []interface{}{
"[INFO]",
}
nArgs = append(nArgs, args...)
log.Println(nArgs...)
}
// Warnf 警告
func (StdLogger) Warnf(ctx context.Context, format string, args ...interface{}) {
log.Printf("[Warn] "+format, args...)
}
// Warnln 警告
func (StdLogger) Warnln(ctx context.Context, args ...interface{}) {
nArgs := []interface{}{
"[Warn]",
}
nArgs = append(nArgs, args...)
log.Println(nArgs...)
}
// Warningf 警告
func (StdLogger) Warningf(ctx context.Context, format string, args ...interface{}) {
log.Printf("[Warning] "+format, args...)
}
// Warningln 警告
func (StdLogger) Warningln(ctx context.Context, args ...interface{}) {
nArgs := []interface{}{
"[Warning]",
}
nArgs = append(nArgs, args...)
log.Println(nArgs...)
}
// Errorf 错误
func (StdLogger) Errorf(ctx context.Context, format string, args ...interface{}) {
log.Printf("[Error] "+format, args...)
}
// Errorln 错误
func (StdLogger) Errorln(ctx context.Context, args ...interface{}) {
nArgs := []interface{}{
"[Error]",
}
nArgs = append(nArgs, args...)
log.Println(nArgs...)
}