dongfeng-pay/shop/main.go

37 lines
612 B
Go
Raw Normal View History

2019-12-19 14:47:58 +08:00
package main
import (
2021-04-27 15:33:49 +08:00
"github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
2021-09-16 16:24:34 +08:00
_ "shop/routers"
2019-12-19 14:47:58 +08:00
)
func main() {
2021-04-27 15:33:49 +08:00
RegisterLogs()
2019-12-19 14:47:58 +08:00
beego.Run()
}
2021-04-27 15:33:49 +08:00
/**
** 注册日志信息
*/
func RegisterLogs() {
logs.SetLogger(logs.AdapterFile,
`{
2021-09-16 16:24:34 +08:00
"filename":"../.../logs/legend.log",
2021-04-27 15:33:49 +08:00
"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")
}