-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxlog.go
69 lines (53 loc) · 1.43 KB
/
xlog.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
// Package xlog acts as a trivial extension of Go's log package.
// It provides functions to prefix the logged output with different
// log levels.
package xlog
import (
"io"
"log"
)
func SetOutput(w io.Writer) {
log.SetOutput(w)
}
func Debug(v ...interface{}) {
log.Print(append([]interface{}{"[DEBUG] "}, v...)...)
}
func Debugf(format string, v ...interface{}) {
log.Printf("[DEBUG] "+format, v...)
}
func Info(v ...interface{}) {
log.Print(append([]interface{}{"[INFO] "}, v...)...)
}
func Infof(format string, v ...interface{}) {
log.Printf("[INFO] "+format, v...)
}
func Warn(v ...interface{}) {
log.Print(append([]interface{}{"[WARN] "}, v...)...)
}
func Warnf(format string, v ...interface{}) {
log.Printf("[WARN] "+format, v...)
}
func Error(v ...interface{}) {
log.Print(append([]interface{}{"[ERROR] "}, v...)...)
}
func Errorf(format string, v ...interface{}) {
log.Printf("[ERROR] "+format, v...)
}
func Fatal(v ...interface{}) {
log.Fatal(append([]interface{}{"[FATAL] "}, v...)...)
}
func Fatalf(format string, v ...interface{}) {
log.Fatalf("[FATAL] "+format, v...)
}
func Panic(v ...interface{}) {
log.Panic(append([]interface{}{"[PANIC] "}, v...)...)
}
func Panicf(format string, v ...interface{}) {
log.Panicf("[PANIC] "+format, v...)
}
func Request(v ...interface{}) {
log.Print(append([]interface{}{"[REQ] "}, v...)...)
}
func Requestf(format string, v ...interface{}) {
log.Printf("[REQ] "+format, v...)
}