|
|
package log
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
|
|
|
"github.com/astaxie/beego/logs"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/constant"
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
logs.SetLevel(logLevel(constant.LOG_LEVEL))
|
|
|
logs.SetLogFuncCall(false)
|
|
|
logs.SetLogger("file", `{"filename":"log/partnermg.log"}`)
|
|
|
logs.SetLogger("file", getlogFileConfig())
|
|
|
logs.Async()
|
|
|
logs.Async(2 * 1e3)
|
|
|
}
|
|
|
|
|
|
func getlogFileConfig() string {
|
|
|
m := map[string]string{
|
|
|
"filename": constant.LOG_File,
|
|
|
}
|
|
|
s, _ := json.Marshal(m)
|
|
|
return string(s)
|
|
|
}
|
|
|
|
|
|
//LogLevel ...
|
|
|
func logLevel(s string) (i int) {
|
|
|
switch s {
|
...
|
...
|
|