Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
364cacf6
authored
2015-06-08 22:00:28 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
record the critical logs in Prod
1 parent
21586586
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
38 deletions
router.go
router.go
View file @
364cacf
...
...
@@ -857,47 +857,28 @@ func (p *ControllerRegistor) recoverPanic(context *beecontext.Context) {
if
err
==
USERSTOPRUN
{
return
}
if
RunMode
==
"dev"
{
if
!
RecoverPanic
{
panic
(
err
)
}
else
{
if
ErrorsShow
{
if
_
,
ok
:=
ErrorMaps
[
fmt
.
Sprint
(
err
)];
ok
{
exception
(
fmt
.
Sprint
(
err
),
context
)
return
}
}
var
stack
string
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
))
stack
=
stack
+
fmt
.
Sprintln
(
fmt
.
Sprintf
(
"%s:%d"
,
file
,
line
))
}
showErr
(
err
,
context
,
stack
)
}
if
!
RecoverPanic
{
panic
(
err
)
}
else
{
if
!
RecoverPanic
{
panic
(
err
)
}
else
{
// in production model show all infomation
if
ErrorsShow
{
if
ErrorsShow
{
if
_
,
ok
:=
ErrorMaps
[
fmt
.
Sprint
(
err
)];
ok
{
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
))
}
return
}
}
var
stack
string
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
))
stack
=
stack
+
fmt
.
Sprintln
(
fmt
.
Sprintf
(
"%s:%d"
,
file
,
line
))
}
if
RunMode
==
"dev"
{
showErr
(
err
,
context
,
stack
)
}
}
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment