-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathlogger.go
67 lines (53 loc) · 1.48 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
package httpreq
import (
"log"
"os"
)
type Logger interface {
Debug(args ...interface{})
Debugf(format string, args ...interface{})
Info(args ...interface{})
Infof(format string, args ...interface{})
Warn(args ...interface{})
Warnf(format string, args ...interface{})
Error(args ...interface{})
Errorf(format string, args ...interface{})
Fatal(args ...interface{})
Fatalf(format string, args ...interface{})
}
type BuiltinLogger struct {
logger *log.Logger
}
func NewBuiltinLogger() *BuiltinLogger {
return &BuiltinLogger{logger: log.New(os.Stdout, "", 5)}
}
func (l *BuiltinLogger) Debug(args ...interface{}) {
l.logger.Println(args...)
}
func (l *BuiltinLogger) Debugf(format string, args ...interface{}) {
l.logger.Printf(format, args...)
}
func (l *BuiltinLogger) Info(args ...interface{}) {
l.logger.Println(args...)
}
func (l *BuiltinLogger) Infof(format string, args ...interface{}) {
l.logger.Printf(format, args...)
}
func (l *BuiltinLogger) Warn(args ...interface{}) {
l.logger.Println(args...)
}
func (l *BuiltinLogger) Warnf(format string, args ...interface{}) {
l.logger.Printf(format, args...)
}
func (l *BuiltinLogger) Error(args ...interface{}) {
l.logger.Println(args...)
}
func (l *BuiltinLogger) Errorf(format string, args ...interface{}) {
l.logger.Printf(format, args...)
}
func (l *BuiltinLogger) Fatal(args ...interface{}) {
l.logger.Println(args...)
}
func (l *BuiltinLogger) Fatalf(format string, args ...interface{}) {
l.logger.Printf(format, args...)
}