-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.go
75 lines (68 loc) · 1.44 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
71
72
73
74
75
package log
import (
"github.com/chi-chu/log/define"
"github.com/chi-chu/log/entry"
"os"
)
func Debug(format string, args ...interface{}) {
if log.Level > define.DEBUG {
return
}
e := entry.NewEntry(define.DEBUG)
e.Hook(log.Hook)
formatFunc[log.TextFormat](e, format, args...)
log.Out.Print(e)
e.Release()
}
func Info(format string, args ...interface{}) {
if log.Level > define.INFO {
return
}
e := entry.NewEntry(define.INFO)
e.Hook(log.Hook)
formatFunc[log.TextFormat](e, format, args...)
log.Out.Print(e)
e.Release()
}
func Warn(format string, args ...interface{}) {
if log.Level > define.WARN {
return
}
e := entry.NewEntry(define.WARN)
e.Hook(log.Hook)
formatFunc[log.TextFormat](e, format, args...)
log.Out.Print(e)
e.Release()
}
func Error(format string, args ...interface{}) {
if log.Level > define.ERROR {
return
}
e := entry.NewEntry(define.ERROR)
e.Hook(log.Hook)
formatFunc[log.TextFormat](e, format, args...)
log.Out.Print(e)
e.Release()
}
func Panic(format string, args ...interface{}) {
if log.Level > define.PANIC {
return
}
e := entry.NewEntry(define.PANIC)
e.Hook(log.Hook)
formatFunc[log.TextFormat](e, format, args...)
log.Out.Print(e)
e.Release()
os.Exit(1)
}
func Fatal(format string, args ...interface{}) {
if log.Level > define.FATAL {
return
}
e := entry.NewEntry(define.FATAL)
e.Hook(log.Hook)
formatFunc[log.TextFormat](e, format, args...)
log.Out.Print(e)
e.Release()
os.Exit(1)
}