mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2024-11-13 14:09:20 +08:00
37 lines
612 B
Go
37 lines
612 B
Go
package main
|
|
|
|
import (
|
|
"github.com/beego/beego/v2/core/logs"
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
_ "shop/routers"
|
|
)
|
|
|
|
func main() {
|
|
RegisterLogs()
|
|
beego.Run()
|
|
}
|
|
|
|
/**
|
|
** 注册日志信息
|
|
*/
|
|
func RegisterLogs() {
|
|
logs.SetLogger(logs.AdapterFile,
|
|
`{
|
|
"filename":"../.../logs/legend.log",
|
|
"level":4,
|
|
"maxlines":0,
|
|
"maxsize":0,
|
|
"daily":true,
|
|
"maxdays":10,
|
|
"color":true
|
|
}`)
|
|
|
|
f := &logs.PatternLogFormatter{
|
|
Pattern: "%F:%n|%w%t>> %m",
|
|
WhenFormat: "2006-01-02",
|
|
}
|
|
|
|
logs.RegisterFormatter("pattern", f)
|
|
_ = logs.SetGlobalFormatter("pattern")
|
|
}
|