Comparing version 1.1.3 to 1.2.0
@@ -46,3 +46,8 @@ var _ = require('lodash'); | ||
} | ||
this.log({ error:true, id:id, message:err.message }); | ||
var errorLogger = this.namespace({ | ||
error: true, | ||
id:id, | ||
now: (new Date()).toISOString() | ||
}) | ||
errorLogger.log({ message:err.message }); | ||
if (err.stack) { | ||
@@ -52,5 +57,5 @@ var stack = err.stack.split('\n'); | ||
if (line >= this.maxErrorLines) break; | ||
this.log({ error:true, id:id, line:line, trace:stack[line] }); | ||
errorLogger.log({ line:line, trace:stack[line] }); | ||
} | ||
} | ||
} |
{ | ||
"name": "logfmt", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "key=value logger and parser", | ||
@@ -5,0 +5,0 @@ "main": "logfmt.js", |
@@ -13,4 +13,14 @@ var logfmt = require('../logfmt'), | ||
var id = logfmt.stream.lines[0].match(/id=(\d+)/)[1]; | ||
assert.equal(logfmt.stream.lines[0], 'error=true id=' + id + ' message=testing\n'); | ||
assert.equal(logfmt.stream.lines[1], 'error=true id=' + id + ' line=0 trace="Error: testing"\n'); | ||
var line1 = logfmt.parse(logfmt.stream.lines[0]) | ||
assert.equal(line1.error, true); | ||
assert.equal(line1.id, id); | ||
assert(line1.now); | ||
assert.equal(line1.message, 'testing'); | ||
var line2 = logfmt.parse(logfmt.stream.lines[1]) | ||
assert.equal(line2.error, true); | ||
assert.equal(line2.id, id); | ||
assert(line2.now); | ||
assert.equal(line2.line, '0'); | ||
assert.equal(line2.trace, 'Error: testing'); | ||
}); | ||
@@ -17,0 +27,0 @@ |
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
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
AI-detected potential security risk
Supply chain riskAI has determined that this package may contain potential security issues or vulnerabilities.
Found 1 instance in 1 package
65369
1505
8