logdna / logger-node

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

fix(send): Allow _serializeBuffer() to be async #71

Closed emelski closed 2 years ago

emelski commented 2 years ago

Note: this looks like a large change but it's not really -- just diff getting confused by the indentation changes The substance of the change is to go from this:

const data = this._serializeBuffer(buffer)
// do stuff with data

to this:

Promise.resolve(this._serializeBuffer(buffer))
  .then((data) => {
    // do stuff with data
  })
  .catch((error) => {
    // Handle errors in resolution of _serializeBuffer
  })

I did not try to refactor the code in // do stuff with data because it's got a bit too much dependency on shared state vis a vis local variables. I think it's possible to refactor it to make that a bit cleaner but I think that's out of scope for this change.

logdnabot commented 2 years ago

:tada: This PR is included in version 2.6.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: