-
Notifications
You must be signed in to change notification settings - Fork 231
/
Copy pathlogger.go
48 lines (38 loc) · 886 Bytes
/
logger.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
package logger
import (
"fmt"
)
var log LogInterface
/*
file, "初始化一个文件日志实例"
console, "初始化console日志实例"
*/
func InitLogger(name string, config map[string]string) (err error) {
switch name {
case "file":
log, err = NewFileLogger(config)
case "console":
log, err = NewConsoleLogger(config)
default:
err = fmt.Errorf("unsupport logger name:%s", name)
}
return
}
func Debug(format string, args ...interface{}) {
log.Debug(format, args...)
}
func Trace(format string, args ...interface{}) {
log.Trace(format, args...)
}
func Info(format string, args ...interface{}) {
log.Info(format, args...)
}
func Warn(format string, args ...interface{}) {
log.Warn(format, args...)
}
func Error(format string, args ...interface{}) {
log.Error(format, args...)
}
func Fatal(format string, args ...interface{}) {
log.Fatal(format, args...)
}