-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlogger_generated.go.tmpl
45 lines (40 loc) · 1.03 KB
/
logger_generated.go.tmpl
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
package log
import (
"fmt"
"time"
)
{{ range .}}
func (l *Logger) Is{{.}}Enabled() bool {
return l.level >= {{.}}Level
}
func (l *Logger) {{.}}(args ...interface{}) {
if l.level < {{.}}Level {
return
}
if !l.source {
l.h.HandleLog({{.}}Level, time.Now(), fmt.Sprint(args...), emptyCaller, l.fields, nil)
} else {
l.h.HandleLog({{.}}Level, time.Now(), fmt.Sprint(args...), caller(l.skip), l.fields, nil)
}
}
func (l *Logger) {{.}}f(format string, args ...interface{}) {
if l.level < {{.}}Level {
return
}
if !l.source {
l.h.HandleLog({{.}}Level, time.Now(), fmt.Sprintf(format, args...), emptyCaller, l.fields, nil)
} else {
l.h.HandleLog({{.}}Level, time.Now(), fmt.Sprintf(format, args...), caller(l.skip), l.fields, nil)
}
}
func (l *Logger) {{.}}F(msg string, fields ...Field) {
if l.level < {{.}}Level {
return
}
if !l.source {
l.h.HandleLog({{.}}Level, time.Now(), msg, emptyCaller, l.fields, fields)
} else {
l.h.HandleLog({{.}}Level, time.Now(), msg, caller(l.skip), l.fields, fields)
}
}
{{ end }}