1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 22:11:29 +00:00

record the critical logs in Prod

This commit is contained in:
astaxie 2015-06-08 22:00:28 +08:00
parent 21586586ba
commit 364cacf659

View File

@ -857,7 +857,6 @@ func (p *ControllerRegistor) recoverPanic(context *beecontext.Context) {
if err == USERSTOPRUN {
return
}
if RunMode == "dev" {
if !RecoverPanic {
panic(err)
} else {
@ -878,27 +877,9 @@ func (p *ControllerRegistor) recoverPanic(context *beecontext.Context) {
Critical(fmt.Sprintf("%s:%d", file, line))
stack = stack + fmt.Sprintln(fmt.Sprintf("%s:%d", file, line))
}
if RunMode == "dev" {
showErr(err, context, stack)
}
} else {
if !RecoverPanic {
panic(err)
} else {
// in production model show all infomation
if ErrorsShow {
exception(fmt.Sprint(err), context)
} else {
Critical("the request url is ", context.Input.Url())
Critical("Handler crashed with error", err)
for i := 1; ; i++ {
_, file, line, ok := runtime.Caller(i)
if !ok {
break
}
Critical(fmt.Sprintf("%s:%d", file, line))
}
}
}
}
}
}