-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnull.go
51 lines (34 loc) · 866 Bytes
/
null.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
package log
import (
"log"
)
// IsZero returns true if logger in context is null logger
func IsZero(l ContextLogger) bool {
_, ok := l.(null)
return ok
}
var defaultLogger = null{}
type null struct{}
func (null) Debug(...interface{}) {}
func (null) Debugf(string, ...interface{}) {}
func (null) Info(...interface{}) {}
func (null) Infof(string, ...interface{}) {}
func (null) Warn(...interface{}) {}
func (null) Warnf(string, ...interface{}) {}
func (null) Error(...interface{}) {}
func (null) Errorf(string, ...interface{}) {}
func (null) Fatal(v ...interface{}) {
log.Fatal(v...)
}
func (null) Fatalf(s string, v ...interface{}) {
log.Fatalf(s, v...)
}
func (null) Panic(v ...interface{}) {
log.Panic(v...)
}
func (null) Panicf(s string, v ...interface{}) {
log.Panicf(s, v...)
}
func (null) WithContext(M) ContextLogger {
return null{}
}