-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
When logging a meta value which contains an error, none of the properties are written, and the log message is lost.
e.g. winston.error("error", new Error("test"))
output in loggly:
{"level":"error"}
- The error properties (message and stack) are not written because node-loggly doesn't write them to the JSON string (they are non-enumerable).
- The log message is lost because the meta parameter, if supplied, forms the base message object appended to and passed to loggly. For Errors this already contains the
messageproperty as a getter which (per the above) isn't written to JSON.
This doesn't seem related to winstonjs/winston#280 which I initially thought was the cause - updating to the latest version of Winston does not solve it.
I think a fix requires more than just fixing the JSON-encoding of Error objects - that would still result in conflict between the two message properties when logging Errors (the error message and the log message). It could be nicer if the meta parameter was written to the loggly message as a meta property within the JSON, but this would be a change to existing behaviour.
Metadata
Metadata
Assignees
Labels
No labels