forked from prometheus-community/pro-bing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
53 lines (39 loc) · 1.15 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
package probing
import "log"
type Logger interface {
Fatalf(format string, v ...interface{})
Errorf(format string, v ...interface{})
Warnf(format string, v ...interface{})
Infof(format string, v ...interface{})
Debugf(format string, v ...interface{})
}
type StdLogger struct {
Logger *log.Logger
}
func (l StdLogger) Fatalf(format string, v ...interface{}) {
l.Logger.Printf("FATAL: "+format, v...)
}
func (l StdLogger) Errorf(format string, v ...interface{}) {
l.Logger.Printf("ERROR: "+format, v...)
}
func (l StdLogger) Warnf(format string, v ...interface{}) {
l.Logger.Printf("WARN: "+format, v...)
}
func (l StdLogger) Infof(format string, v ...interface{}) {
l.Logger.Printf("INFO: "+format, v...)
}
func (l StdLogger) Debugf(format string, v ...interface{}) {
l.Logger.Printf("DEBUG: "+format, v...)
}
type NoopLogger struct {
}
func (l NoopLogger) Fatalf(format string, v ...interface{}) {
}
func (l NoopLogger) Errorf(format string, v ...interface{}) {
}
func (l NoopLogger) Warnf(format string, v ...interface{}) {
}
func (l NoopLogger) Infof(format string, v ...interface{}) {
}
func (l NoopLogger) Debugf(format string, v ...interface{}) {
}