beelog.go
1.0 KB
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
package log
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/config"
"path/filepath"
"strconv"
)
type beegoLog struct {
log *logs.BeeLogger
}
func newbeelog(conf config.Logger)Log{
filename := `{"filename":"` + filepath.ToSlash(conf.Filename) + `"}`
l :=&beegoLog{
log:logs.GetBeeLogger(),
}
l.log.SetLogger(logs.AdapterFile,filename)
ilv,err :=strconv.Atoi(conf.Level)
if err!=nil{
ilv = logs.LevelDebug
}
l.log.SetLevel(ilv)
l.log.EnableFuncCallDepth(true)
l.log.SetLogFuncCallDepth(6)
return l
}
func(this *beegoLog)Debug(args ...interface{}){
//this.log.Debug(args...)
beego.Debug(args...)
}
func(this *beegoLog)Info(args ...interface{}){
beego.Info(args...)
}
func(this *beegoLog)Warn(args ...interface{}){
beego.Warn(args...)
}
func(this *beegoLog)Error(args ...interface{}){
beego.Error(args...)
}
func(this *beegoLog)Panic(args ...interface{}){
beego.Error(args...)
}
func(this *beegoLog)Fatal(args ...interface{}){
beego.Error(args...)
}