-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
61 lines (46 loc) · 1.55 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
package logger
var std Logger = new(none)
// Debugf writes a debug message to the standard logger.
func Debugf(format string, args ...interface{}) {
std.Debugf(format, args...)
}
// Verbosef writes a verbose message to the standard logger.
func Verbosef(format string, args ...interface{}) {
std.Verbosef(format, args...)
}
// Noticef writes a notice message to the standard logger.
func Noticef(format string, args ...interface{}) {
std.Noticef(format, args...)
}
// Warningf writes a warning message to the standard logger.
func Warningf(format string, args ...interface{}) {
std.Warningf(format, args...)
}
// Printf writes a default message to the standard logger.
func Printf(format string, args ...interface{}) {
std.Printf(format, args...)
}
// SetLogger sets the standard logger.
func SetLogger(logger Logger) {
std = logger
}
// Logger represents a logger.
type Logger interface {
// Debugf writes a debug message.
Debugf(string, ...interface{})
// Verbosef writes a verbose message.
Verbosef(string, ...interface{})
// Noticef writes a notice message.
Noticef(string, ...interface{})
// Warningf writes a warning message.
Warningf(string, ...interface{})
// Printf writes a default message.
Printf(string, ...interface{})
}
// none is a logger that silently ignores all writes.
type none struct{}
func (*none) Debugf(string, ...interface{}) {}
func (*none) Verbosef(string, ...interface{}) {}
func (*none) Noticef(string, ...interface{}) {}
func (*none) Warningf(string, ...interface{}) {}
func (*none) Printf(string, ...interface{}) {}