-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
76 lines (70 loc) · 1.74 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
package loopia
import (
"sync"
)
type iLogger interface {
Errorw(msg string, args ...interface{})
Errorf(format string, args ...interface{})
Fatalf(format string, args ...interface{})
Fatal(args ...interface{})
Infof(format string, args ...interface{})
Info(args ...interface{})
Warnf(format string, args ...interface{})
Warnw(msg string, args ...interface{})
Debug(args ...interface{})
Debugf(format string, args ...interface{})
Debugw(msg string, args ...interface{})
}
type loggerWrapper struct {
}
func (logger *loggerWrapper) Errorw(msg string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Errorf(format string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Fatalf(format string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Fatal(args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Info(args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Infof(format string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Warnf(format string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Warnw(msg string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Debug(args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Debugf(format string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Debugw(msg string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Printf(format string, args ...interface{}) {
// noop
}
func (logger *loggerWrapper) Println(args ...interface{}) {
// noop
}
func Log() iLogger {
defaultLoggerMu.RLock()
defer defaultLoggerMu.RUnlock()
if defaultLogger == nil {
defaultLogger = &loggerWrapper{}
}
return defaultLogger
}
var (
defaultLogger iLogger
defaultLoggerMu sync.RWMutex
)