mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 06:11:29 +00:00
remove the hardcode in runtime.Caller
This commit is contained in:
parent
0207caab6f
commit
c8f6e0f156
@ -157,18 +157,15 @@ func (bl *BeeLogger) writerMsg(loglevel int, msg string) error {
|
|||||||
lm.level = loglevel
|
lm.level = loglevel
|
||||||
if bl.enableFuncCallDepth {
|
if bl.enableFuncCallDepth {
|
||||||
_, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth)
|
_, file, line, ok := runtime.Caller(bl.loggerFuncCallDepth)
|
||||||
if _, filename := path.Split(file); filename == "log.go" && (line == 97 || line == 83) {
|
if !ok {
|
||||||
_, file, line, ok = runtime.Caller(bl.loggerFuncCallDepth + 1)
|
file = "???"
|
||||||
|
line = 0
|
||||||
}
|
}
|
||||||
if ok {
|
|
||||||
_, filename := path.Split(file)
|
_, filename := path.Split(file)
|
||||||
lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
|
lm.msg = fmt.Sprintf("[%s:%d] %s", filename, line, msg)
|
||||||
} else {
|
} else {
|
||||||
lm.msg = msg
|
lm.msg = msg
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
lm.msg = msg
|
|
||||||
}
|
|
||||||
if bl.asynchronous {
|
if bl.asynchronous {
|
||||||
bl.msg <- lm
|
bl.msg <- lm
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user