-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.go
101 lines (71 loc) · 2.16 KB
/
interface.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package logg
import (
"fmt"
"io"
)
// PRINT
func (l *Logg) Print(args ...interface{}) {
l.write(1, Empty, []byte(fmt.Sprint(args...)))
}
func (l *Logg) Printf(format string, args ...interface{}) {
l.write(1, Empty, []byte(fmt.Sprintf(format, args...)))
}
func (l *Logg) Debug(args ...interface{}) {
l.write(1, Debug, []byte(fmt.Sprint(args...)))
}
func (l *Logg) Debugf(format string, args ...interface{}) {
l.write(1, Debug, []byte(fmt.Sprintf(format, args...)))
}
func (l *Logg) Info(args ...interface{}) {
l.write(1, Info, []byte(fmt.Sprint(args...)))
}
func (l *Logg) Infof(format string, args ...interface{}) {
l.write(1, Info, []byte(fmt.Sprintf(format, args...)))
}
func (l *Logg) Error(args ...interface{}) {
l.write(0, Error, []byte(fmt.Sprint(args...)))
}
func (l *Logg) Errorf(format string, args ...interface{}) {
l.write(1, Error, []byte(fmt.Sprintf(format, args...)))
}
func (l *Logg) Warn(args ...interface{}) {
l.write(1, Warning, []byte(fmt.Sprint(args...)))
}
func (l *Logg) Warnf(format string, args ...interface{}) {
l.write(1, Warning, []byte(fmt.Sprintf(format, args...)))
}
func (l *Logg) Panic(args ...interface{}) {
l.write(1, Panic, []byte(fmt.Sprint(args...)))
}
func (l *Logg) Panicf(format string, args ...interface{}) {
l.write(1, Panic, []byte(fmt.Sprintf(format, args...)))
}
// SETTINGS
func (l *Logg) DebugMode() {
l.flags = Ldate | Ltime | Lmicroseconds | Lshortfile
l.minLevel = Debug
}
func (l *Logg) SetFormat(format format) {
l.format = format
}
func (l *Logg) SetFlags(flags int) {
l.flags = flags
}
func (l *Logg) SetWriter(w io.Writer) {
l.out = w
}
func (l *Logg) ToggleColor(value bool) {
l.color = value
}
func (l *Logg) MinLevel(level level) {
l.minLevel = level
}
// Global
func Print(args ...interface{}) { logg.Print(args...) }
func Printf(format string, args ...interface{}) { logg.Printf(format, args...) }
func DebugMode() { logg.DebugMode() }
func SetFormat(format format) { logg.SetFormat(format) }
func SetFlags(flags int) { logg.SetFlags(flags) }
func SetWriter(w io.Writer) { logg.SetWriter(w) }
func ToggleColor(value bool) { logg.ToggleColor(value) }
func MinLevel(level level) { logg.MinLevel(level) }