common.go
585 字节
package common
import (
"oppmg/common/config"
"oppmg/common/log"
"github.com/astaxie/beego"
)
func ResetCommonConfig() {
mconfig := config.RestMyConfig()
var setlog log.SetLoggerConfig
if mconfig.LogOutput == "console" {
setlog = &log.LoggerConsole{
Level: log.LogLevelDebug, Color: false,
}
} else if mconfig.LogOutput == "file" {
setlog = &log.LoggerFile{
Level: log.LogLevel(mconfig.LogLevel),
FileName: mconfig.LogFilename,
}
}
var logCallfunc bool
if beego.BConfig.RunMode != "prod" {
logCallfunc = true
}
log.ResetLog(setlog, logCallfunc)
}