-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathlogger.go
46 lines (38 loc) · 1.17 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
package bitcoin
import (
"fmt"
"log"
)
type Logger interface {
// Debugf logs a message at debug level.
Debugf(format string, args ...interface{})
// Infof logs a message at info level.
Infof(format string, args ...interface{})
// Warnf logs a message at warn level.
Warnf(format string, args ...interface{})
// Errorf logs a message at error level.
Errorf(format string, args ...interface{})
// Fatalf logs a message at fatal level.
Fatalf(format string, args ...interface{})
}
type DefaultLogger struct{}
func (l *DefaultLogger) Debugf(format string, args ...interface{}) {
f := fmt.Sprintf("DEBUG: %s", format)
log.Printf(f, args...)
}
func (l *DefaultLogger) Infof(format string, args ...interface{}) {
f := fmt.Sprintf("INFO: %s", format)
log.Printf(f, args...)
}
func (l *DefaultLogger) Warnf(format string, args ...interface{}) {
f := fmt.Sprintf("wARN: %s", format)
log.Printf(f, args...)
}
func (l *DefaultLogger) Errorf(format string, args ...interface{}) {
f := fmt.Sprintf("ERROR: %s", format)
log.Printf(f, args...)
}
func (l *DefaultLogger) Fatalf(format string, args ...interface{}) {
f := fmt.Sprintf("FATAL: %s", format)
log.Printf(f, args...)
}