logdna / logger-node

A nodejs logger client for LogDNA
MIT License
34 stars 17 forks source link

optionally include entire payload in send and error events #60

Closed emelski closed 2 years ago

emelski commented 2 years ago

For monitoring purposes and to facilitate higher-level retry logic, it would be helpful to include the entire payload of the buffer sent when emitting send and error events.

Currently the send and error events inform the user only of the statement component of first and last lines in the buffer that was sent (or attempted to send). Unfortunately since the logger is managing buffering, it's generally not possible to know all of the lines between the first and last, so there's no way to know all of the lines that were involved in the event. In addition, the data passed to the log() call in the meta option is not included. With this change, the send and error events will include a new buffer member that is simply the raw buffer that was sent. This will of course include both the statement and the meta (in stringified form), as well as other fields. The event handlers can handle deserializing the metadata as needed, so the logger need not bother.

Many users may not need this information included, and excluding it would allow it to be garbage collected sooner, so it would be best to make the inclusion of this data in the event optional based on a configuration option such as verboseEvents.

logdnabot commented 2 years ago

:tada: This issue has been resolved in version 2.6.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: