1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-01 21:13:27 +00:00

fix the log level

This commit is contained in:
astaxie 2014-10-30 17:43:32 +08:00
parent 1636a7271c
commit 71149218d1
2 changed files with 5 additions and 1 deletions

View File

@ -277,6 +277,7 @@ func init() {
if err != nil {
fmt.Println("init console log error:", err)
}
BeeLogger.SetLogFuncCallDepth(true)
err = ParseConfig()
if err != nil && !os.IsNotExist(err) {

View File

@ -154,7 +154,10 @@ func (bl *BeeLogger) writerMsg(loglevel int, msg string) error {
lm := new(logMsg)
lm.level = loglevel
if bl.enableFuncCallDepth {
_, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth)
_, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth + 1)
if !ok {
_, file, line, ok = runtime.Caller(bl.loggerFuncCallDepth)
}
if ok {
_, filename := path.Split(file)
lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)