Ensure that more error stacks get recorded

This commit is contained in:
Dane Everitt 2020-06-22 20:48:38 -07:00
parent db31722cfc
commit f318962371
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -70,6 +70,8 @@ func (h *Handler) HandleLog(e *log.Entry) error {
}
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 {
st := e.StackTrace()
@ -78,11 +80,9 @@ func (h *Handler) HandleLog(e *log.Entry) error {
l = 5
}
br := color2.New(color2.Bold, color2.FgRed)
fmt.Fprintf(h.Writer, "\n%s%+v\n\n", br.Sprintf("Stacktrace:"), st[0:l])
} else {
fmt.Printf("\n\nINVALID TRACER\n\n")
fmt.Fprintf(h.Writer, "\n%s\n%+v\n\n", br.Sprintf("Stacktrace:"), err)
}
} else {
fmt.Printf("\n\nINVALID ERROR\n\n")