-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogging.go
68 lines (48 loc) · 1.54 KB
/
logging.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
package whatnot
var whatlogger Logger = nilLogger{}
// Logger allows you to implement/attach your own logger
type Logger interface {
Debug(msg string)
Debugf(format string, a ...interface{})
Info(msg string)
Infof(format string, a ...interface{})
Warn(msg string)
Warnf(format string, a ...interface{})
Error(msg string)
Errorf(format string, a ...interface{})
}
type logsupport struct{}
func (n logsupport) Debug(msg string) {
whatlogger.Debug(msg)
}
func (n logsupport) Debugf(format string, a ...interface{}) {
whatlogger.Debugf(format, a...)
}
func (n logsupport) Info(msg string) {
whatlogger.Info(msg)
}
func (n logsupport) Infof(format string, a ...interface{}) {
whatlogger.Infof(format, a...)
}
func (n logsupport) Warn(msg string) {
whatlogger.Warn(msg)
}
func (n logsupport) Warnf(format string, a ...interface{}) {
whatlogger.Warnf(format, a...)
}
func (n logsupport) Error(msg string) {
whatlogger.Error(msg)
}
func (n logsupport) Errorf(format string, a ...interface{}) {
whatlogger.Errorf(format, a...)
}
// nilLogger provides fallback dummy logging if no logger is attached to a namespace manager
type nilLogger struct{}
func (n nilLogger) Debug(msg string) {}
func (n nilLogger) Debugf(format string, a ...interface{}) {}
func (n nilLogger) Info(msg string) {}
func (n nilLogger) Infof(format string, a ...interface{}) {}
func (n nilLogger) Warn(msg string) {}
func (n nilLogger) Warnf(format string, a ...interface{}) {}
func (n nilLogger) Error(msg string) {}
func (n nilLogger) Errorf(format string, a ...interface{}) {}