Ensure that more error stacks get recorded
This commit is contained in:
parent
db31722cfc
commit
f318962371
|
@ -70,6 +70,8 @@ func (h *Handler) HandleLog(e *log.Entry) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err, ok := e.Fields.Get("error").(error); ok {
|
if err, ok := e.Fields.Get("error").(error); ok {
|
||||||
|
var br = color2.New(color2.Bold, color2.FgRed)
|
||||||
|
|
||||||
if e, ok := errors.Cause(err).(tracer); ok {
|
if e, ok := errors.Cause(err).(tracer); ok {
|
||||||
st := e.StackTrace()
|
st := e.StackTrace()
|
||||||
|
|
||||||
|
@ -78,11 +80,9 @@ func (h *Handler) HandleLog(e *log.Entry) error {
|
||||||
l = 5
|
l = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
br := color2.New(color2.Bold, color2.FgRed)
|
|
||||||
|
|
||||||
fmt.Fprintf(h.Writer, "\n%s%+v\n\n", br.Sprintf("Stacktrace:"), st[0:l])
|
fmt.Fprintf(h.Writer, "\n%s%+v\n\n", br.Sprintf("Stacktrace:"), st[0:l])
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("\n\nINVALID TRACER\n\n")
|
fmt.Fprintf(h.Writer, "\n%s\n%+v\n\n", br.Sprintf("Stacktrace:"), err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("\n\nINVALID ERROR\n\n")
|
fmt.Printf("\n\nINVALID ERROR\n\n")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user