-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnop.go
49 lines (29 loc) · 1.06 KB
/
nop.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
package xlog
import "context"
type nop struct{}
// NopLogger is an no-op implementation of xlog.Logger
var NopLogger = &nop{}
func (n nop) SetField(name string, value interface{}) {}
func (n nop) SetFields(fields F) {}
func (n nop) GetFields() F { return map[string]interface{}{} }
func (n nop) OutputF(level Level, calldepth int, msg string, fields map[string]interface{}, err error) {
}
func (n nop) Debug(v ...interface{}) {}
func (n nop) Debugf(format string, v ...interface{}) {}
func (n nop) Info(v ...interface{}) {}
func (n nop) Infof(format string, v ...interface{}) {}
func (n nop) Warn(v ...interface{}) {}
func (n nop) Warnf(format string, v ...interface{}) {}
func (n nop) Error(v ...interface{}) {}
func (n nop) Errorf(format string, v ...interface{}) {}
func (n nop) Fatal(v ...interface{}) {
exit1()
}
func (n nop) Fatalf(format string, v ...interface{}) {
exit1()
}
func (n nop) Write(p []byte) (int, error) { return len(p), nil }
func (n nop) Output(calldepth int, s string) error {
return nil
}
func (n nop) SetContext(ctx context.Context) {}