-
Notifications
You must be signed in to change notification settings - Fork 6
/
log.go
50 lines (43 loc) · 1.02 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
package log
import (
"fmt"
"github.com/golang/glog"
)
func Debug(msg string) {
glog.V(1).Info(fmt.Sprintf("[DEBUG]\t%s", msg))
}
func Info(msg string) {
glog.InfoDepth(1, fmt.Sprintf("[INFO]\t%s", msg))
if slsclient != nil {
sendLogToSLS("INFO", msg)
}
}
func Warning(msg string) {
glog.InfoDepth(1, fmt.Sprintf("[WARNING]\t%s", msg))
if slsclient != nil {
sendLogToSLS("WARNING", msg)
}
}
func Error(msg string) {
glog.InfoDepth(1, fmt.Sprintf("[ERROR]\t%s", msg))
if slsclient != nil {
sendLogToSLS("ERROR", msg)
}
}
func Flush() {
glog.Flush()
}
type ABTestLogger struct{}
func (l ABTestLogger) Infof(msg string, args ...interface{}) {
Info(fmt.Sprintf(msg, args...))
}
func (l ABTestLogger) Errorf(msg string, args ...interface{}) {
Error(fmt.Sprintf(msg, args...))
}
type FeatureStoreLogger struct{}
func (l FeatureStoreLogger) Infof(msg string, args ...interface{}) {
Info(fmt.Sprintf(msg, args...))
}
func (l FeatureStoreLogger) Errorf(msg string, args ...interface{}) {
Error(fmt.Sprintf(msg, args...))
}