-
Notifications
You must be signed in to change notification settings - Fork 43
/
logger.go
37 lines (32 loc) · 964 Bytes
/
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
package eslgo
import (
"log"
)
type Logger interface {
Debug(format string, args ...interface{})
Info(format string, args ...interface{})
Warn(format string, args ...interface{})
Error(format string, args ...interface{})
}
type NilLogger struct{}
type NormalLogger struct{}
func (l NormalLogger) Debug(format string, args ...interface{}) {
log.Print("DEBUG: ")
log.Printf(format, args...)
}
func (l NormalLogger) Info(format string, args ...interface{}) {
log.Print("INFO: ")
log.Printf(format, args...)
}
func (l NormalLogger) Warn(format string, args ...interface{}) {
log.Print("WARN: ")
log.Printf(format, args...)
}
func (l NormalLogger) Error(format string, args ...interface{}) {
log.Print("ERROR: ")
log.Printf(format, args...)
}
func (l NilLogger) Debug(string, ...interface{}) {}
func (l NilLogger) Info(string, ...interface{}) {}
func (l NilLogger) Warn(string, ...interface{}) {}
func (l NilLogger) Error(string, ...interface{}) {}