Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #30 from Financial-Times/aintgoin2goa-patch-1
Browse files Browse the repository at this point in the history
Single line stacktrace
  • Loading branch information
aintgoin2goa authored Sep 13, 2016
2 parents 94d235d + 38630c1 commit 90fcea7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const extractErrorDetails = err => {
error_name: err.name
};
if (err.stack) {
deets.error_stack = err.stack;
// logs need to all be on one line, so remove newlines from the stacktrace
deets.error_stack = err.stack.replace(/\n/g, '; ');
}

return deets;
Expand Down
2 changes: 1 addition & 1 deletion test/logger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Logger', () => {
logger.log('info', new MyError('whoops!'));
logSpy.lastCall.args[1].should.have.property('error_message', 'whoops!');
logSpy.lastCall.args[1].should.have.property('error_name', 'Error');
logSpy.lastCall.args[1].error_stack.should.startWith('Error: whoops!\n at');
logSpy.lastCall.args[1].error_stack.should.startWith('Error: whoops!; at');
});

it('should combine Error message meta', () => {
Expand Down

0 comments on commit 90fcea7

Please sign in to comment.