/
echologger.go
79 lines (58 loc) · 1.12 KB
/
echologger.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
71
72
73
74
75
76
77
78
79
package logging
import (
"io"
"fmt"
"github.com/labstack/gommon/log"
)
type EchoLogger struct {
*Logger
prefix string
level uint8
}
func (el *EchoLogger) Output() io.Writer {
return el
}
func (el *EchoLogger) SetHeader(h string) {
}
func (el *EchoLogger) SetOutput(w io.Writer) {
}
func (el *EchoLogger) Prefix() string {
return el.prefix
}
func (el *EchoLogger) SetPrefix(p string) {
el.prefix = p
}
func (el *EchoLogger) Level() log.Lvl {
return log.Lvl(el.level)
}
func (el *EchoLogger) SetLevel(v log.Lvl) {
el.level = uint8(v)
}
func (el *EchoLogger) Print(i ...interface{}) {
el.Info(i)
}
func (el *EchoLogger) Printf(format string, args ...interface{}) {
str := fmt.Sprintf(format, args...)
el.Info(str)
}
func (el *EchoLogger) Printj(j log.JSON) {
el.Info(j)
}
func (el *EchoLogger) Debugj(j log.JSON) {
el.Debug(j)
}
func (el *EchoLogger) Infoj(j log.JSON) {
el.Info(j)
}
func (el *EchoLogger) Warnj(j log.JSON) {
el.Warn(j)
}
func (el *EchoLogger) Errorj(j log.JSON) {
el.Error(j)
}
func (el *EchoLogger) Fatalj(j log.JSON) {
el.Fatal(j)
}
func (el *EchoLogger) Panicj(j log.JSON) {
el.Fatal(j)
}