Closed tlvince closed 3 years ago
The name of Error objects is not included in the log metadata. It is omitted as it's a non-enumerable property on Error.prototype, not the instance and so https://github.com/KyleRoss/node-lambda-log/blob/43a32ad46d9d9a00b96fe79a5f445c5079f0071d/lib/LogMessage.js#L240 will always return false.
Error.prototype
false
The Error name to be included in metadata
const log = require('lambda-log') const error = new Error('foo') log.error('bar', { error })
{ "_logLevel": "error", "msg": "bar", "error": { "message": "foo", "stack": "Error: foo\n at Object.<anonymous> (/tmp/index.js:436:13)\n at Module._compile (internal/modules/cjs/loader.js:1072:14)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)\n at Module.load (internal/modules/cjs/loader.js:937:32)\n at Function.Module._load (internal/modules/cjs/loader.js:778:12)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)\n at internal/main/run_main_module.js:17:47" }, "_tags": [] }
Operating System: Linux Node Version: 14.17.5 Lambda Log Version: 3.0.0
:tada: This issue has been resolved in version 3.0.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
What happens?
The name of Error objects is not included in the log metadata. It is omitted as it's a non-enumerable property on
Error.prototype
, not the instance and so https://github.com/KyleRoss/node-lambda-log/blob/43a32ad46d9d9a00b96fe79a5f445c5079f0071d/lib/LogMessage.js#L240 will always returnfalse
.What were you expecting to happen?
The Error name to be included in metadata
Steps to reproduce
Environment
Operating System: Linux Node Version: 14.17.5 Lambda Log Version: 3.0.0