Skip to content

Commit 2264198

Browse files
committedFeb 6, 2017
If record has an err set the stack to message for Stackdriver display
Stackdriver/Google error reporting requires that error logs have a V8 stacktrace as the payload `message`: https://cloud.google.com/error-reporting/docs/formatting-error-messages They also require setting a service context (`"serviceContext": {"service": "worker"}`) but this can be done in serialisers or on Bunyan loggers themselves
1 parent 051a2e2 commit 2264198

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎lib/bunyan-stackdriver.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ BunyanStackDriver.prototype._write = function write(record, encoding, callback)
9393
record = destroyCircular(record);
9494
strictJSON(record);
9595

96-
if (!record.message) {
96+
if (record.err) {
97+
record.message = record.err.stack;
98+
} else if (!record.message) {
9799
record.message = record.msg;
98100
}
99101

0 commit comments

Comments
 (0)
Failed to load comments.