loglevel-mixin
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -155,10 +155,10 @@ /* jslint node: true, esnext: true */ | ||
} else { | ||
if(arg === undefined) { | ||
if (arg === undefined) { | ||
return Object.assign(logevent, args); | ||
} | ||
if (arg instanceof Error && arg.stack) { | ||
logevent.stack = arg.stack.split(/\n/).map(l => l.trim()); | ||
} else if (arg.error instanceof Error && arg.error.stack) { | ||
logevent.stack = arg.error.stack.split(/\n/).map(l => l.trim()); | ||
if (arg instanceof Error) { | ||
mapError(logevent, arg); | ||
} else if (arg.error instanceof Error) { | ||
mapError(logevent, arg.error); | ||
} | ||
@@ -169,1 +169,8 @@ | ||
}; | ||
function mapError(logevent, error) { | ||
if (error.stack) { | ||
logevent.stack = error.stack.split(/\n/).map(l => l.trim()); | ||
} | ||
logevent.message = error.message; | ||
} |
@@ -22,7 +22,7 @@ { | ||
"cracks": "3.1.2", | ||
"cz-conventional-changelog": "^1.1.5", | ||
"cz-conventional-changelog": "1.1.6", | ||
"istanbul": "0.4.3", | ||
"jsdoc": "3.4.0", | ||
"mocha": "2.4.5", | ||
"semantic-release": "6.2.1" | ||
"semantic-release": "6.2.2" | ||
}, | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
}, | ||
"version": "1.4.1" | ||
"version": "1.4.2" | ||
} |
@@ -27,3 +27,3 @@ /* global describe, it*/ | ||
}); | ||
describe('error object', () => { | ||
@@ -33,2 +33,3 @@ describe('direct', () => { | ||
it('has stack', () => assert.isArray(le.stack)); | ||
it('has error message', () => assert.equal(le.message, 'the error')); | ||
}); | ||
@@ -40,2 +41,3 @@ describe('indirect', () => { | ||
it('has stack', () => assert.isArray(le.stack)); | ||
it('has error message', () => assert.equal(le.message, 'the error')); | ||
}); | ||
@@ -42,0 +44,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
18308
339