ecs-logs-js
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,2 +1,6 @@ | ||
0.2.0 | ||
===== | ||
* Don't swallow errors when they are logged at the top level. | ||
0.1.0 | ||
@@ -3,0 +7,0 @@ ===== |
@@ -274,2 +274,5 @@ /** | ||
function extractErrors(obj) { | ||
if (obj instanceof Error) { | ||
return [obj]; | ||
} | ||
var errors = []; | ||
@@ -276,0 +279,0 @@ |
{ | ||
"name": "ecs-logs-js", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Logger based on winston formatting messages compatible with ecs-logs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -356,3 +356,3 @@ var assert = require('assert'); | ||
it('should not produce log messages bellow warnings', function() { | ||
it('should produce log messages with top-level errors', function() { | ||
var messages = []; | ||
@@ -363,2 +363,41 @@ var logger = new ecslogs.Logger({ | ||
}, | ||
timestamp: now, | ||
hostname: 'localhost' | ||
}); | ||
logger.error('something went wrong', new TestError('oops!')); | ||
assert.deepEqual(messages, [ | ||
{ | ||
level: 'ERROR', | ||
time: '2016-07-02T21:11:47.000Z', | ||
info: { | ||
host: 'localhost', | ||
errors: [ | ||
{ | ||
type: 'TestError', | ||
error: 'oops!', | ||
stack: [ | ||
'at test3 (test.js:3:1)', | ||
'at test2 (test.js:2:1)', | ||
'at test1 (test.js:1:1)' | ||
], | ||
} | ||
] | ||
}, | ||
data: { | ||
message: 'oops!', | ||
stack: "Error: oops!\n\tat test3 (test.js:3:1)\n\tat test2 (test.js:2:1)\n\tat test1 (test.js:1:1)\n" | ||
}, | ||
message: 'something went wrong' | ||
} | ||
]); | ||
}); | ||
it('should not produce log messages below warnings', function() { | ||
var messages = []; | ||
var logger = new ecslogs.Logger({ | ||
output: function(msg) { | ||
messages.push(JSON.parse(msg)) | ||
}, | ||
level: 'warn', | ||
@@ -365,0 +404,0 @@ timestamp: now, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22999
669
10
1