-
Notifications
You must be signed in to change notification settings - Fork 42
/
log.go
60 lines (48 loc) · 1.21 KB
/
log.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
package faktory_worker
import (
"log"
"os"
)
type Logger interface {
Debug(v ...interface{})
Debugf(format string, args ...interface{})
Info(v ...interface{})
Infof(format string, args ...interface{})
Warn(v ...interface{})
Warnf(format string, args ...interface{})
Error(v ...interface{})
Errorf(format string, args ...interface{})
Fatal(v ...interface{})
Fatalf(format string, args ...interface{})
}
type StdLogger struct {
*log.Logger
}
func NewStdLogger() Logger {
flags := log.Ldate | log.Ltime | log.Lmicroseconds | log.LUTC
return &StdLogger{log.New(os.Stdout, "", flags)}
}
func (l *StdLogger) Debug(v ...interface{}) {
l.Println(v...)
}
func (l *StdLogger) Debugf(format string, v ...interface{}) {
l.Printf(format+"\n", v...)
}
func (l *StdLogger) Error(v ...interface{}) {
l.Println(v...)
}
func (l *StdLogger) Errorf(format string, v ...interface{}) {
l.Printf(format+"\n", v...)
}
func (l *StdLogger) Info(v ...interface{}) {
l.Println(v...)
}
func (l *StdLogger) Infof(format string, v ...interface{}) {
l.Printf(format+"\n", v...)
}
func (l *StdLogger) Warn(v ...interface{}) {
l.Println(v...)
}
func (l *StdLogger) Warnf(format string, v ...interface{}) {
l.Printf(format+"\n", v...)
}