about summary refs log tree commit diff
path: root/tools/nixery/server
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-10-28T17·20+0100
committerVincent Ambo <github@tazj.in>2019-10-28T21·31+0100
commitc08aa525587add05af2ff8e7f9ddc697858c9d0c (patch)
tree8f824e1debb029faacccbe96d68531e7bea515df /tools/nixery/server
parent790bce219cf9acf01de3257fcf137a0a2833529e (diff)
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.
Diffstat (limited to 'tools/nixery/server')
-rw-r--r--tools/nixery/server/logs.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/nixery/server/logs.go b/tools/nixery/server/logs.go
index dec4a410fb06..cc218c69d265 100644
--- a/tools/nixery/server/logs.go
+++ b/tools/nixery/server/logs.go
@@ -76,6 +76,13 @@ func (f stackdriverFormatter) Format(e *log.Entry) ([]byte, error) {
 	msg["eventTime"] = &e.Time
 	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) {
 		loc := reportLocation{
 			FilePath:     e.Caller.File,