This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
log.go
70 lines (56 loc) · 1.53 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
61
62
63
64
65
66
67
68
69
70
package logger
import (
"log"
"os"
)
// Logger interface used by the go sdk
type Logger interface {
Debug(v ...interface{})
Debugf(format string, v ...interface{})
Info(v ...interface{})
Infof(format string, v ...interface{})
Warn(v ...interface{})
Warnf(format string, v ...interface{})
Error(v ...interface{})
Errorf(format string, v ...interface{})
Fatal(v ...interface{})
Fatalf(format string, v ...interface{})
}
// DefaultLogger implementation of Logger using the go log package
type DefaultLogger struct {
logger *log.Logger
}
// NewDefaultLogger creates a new Default Logger
func NewDefaultLogger() *DefaultLogger {
return &DefaultLogger{logger: log.New(os.Stdout, "", 5)}
}
func (d DefaultLogger) Debug(v ...interface{}) {
d.logger.Println(v...)
}
func (d DefaultLogger) Debugf(format string, v ...interface{}) {
d.logger.Printf(format, v...)
}
func (d DefaultLogger) Info(v ...interface{}) {
d.logger.Println(v...)
}
func (d DefaultLogger) Infof(format string, v ...interface{}) {
d.logger.Printf(format, v...)
}
func (d DefaultLogger) Warn(v ...interface{}) {
d.logger.Println(v...)
}
func (d DefaultLogger) Warnf(format string, v ...interface{}) {
d.logger.Printf(format, v...)
}
func (d DefaultLogger) Error(v ...interface{}) {
d.logger.Print(v...)
}
func (d DefaultLogger) Errorf(format string, v ...interface{}) {
d.logger.Printf(format, v...)
}
func (d DefaultLogger) Fatal(v ...interface{}) {
d.logger.Fatal(v...)
}
func (d DefaultLogger) Fatalf(format string, v ...interface{}) {
d.logger.Fatalf(format, v...)
}