fix(server): Ensure error messages are correctly printed in logs
I assumed (incorrectly) that logrus would already take care of surfacing error messages in human-readable form.
This commit is contained in:
parent
790bce219c
commit
c08aa52558
1 changed files with 7 additions and 0 deletions
|
@ -76,6 +76,13 @@ func (f stackdriverFormatter) Format(e *log.Entry) ([]byte, error) {
|
||||||
msg["eventTime"] = &e.Time
|
msg["eventTime"] = &e.Time
|
||||||
msg["severity"] = logSeverity(e.Level)
|
msg["severity"] = logSeverity(e.Level)
|
||||||
|
|
||||||
|
if err, ok := msg[log.ErrorKey]; ok {
|
||||||
|
// TODO(tazjin): Cast safely - for now there should be
|
||||||
|
// no calls to `.WithError` with a nil error, but who
|
||||||
|
// knows.
|
||||||
|
msg[log.ErrorKey] = (err.(error)).Error()
|
||||||
|
}
|
||||||
|
|
||||||
if isError(e) {
|
if isError(e) {
|
||||||
loc := reportLocation{
|
loc := reportLocation{
|
||||||
FilePath: e.Caller.File,
|
FilePath: e.Caller.File,
|
||||||
|
|
Loading…
Reference in a new issue