logdna / logdna-winston

LogDNA's Node.js logging module with support for Winston
MIT License
16 stars 14 forks source link

Logger unexpectedly merging objects #12

Closed tony-g closed 4 years ago

tony-g commented 5 years ago

Hi, trying out logdna, and with the following:

"logdna-winston": "2.2.2",
"winston": "3.2.1"
  const options = {
    key: apiKey,
    app,
    env,
    index_meta: true
  }

  const winstLogger = winston.createLogger({
    transports: [
      new logdnaWinston(options),
      new winston.transports.Console({
        format: winston.format.simple()
      })
    ]
  })

  winstLogger.info('1', { '1': true, x: { a: 1 } })
  winstLogger.info('2', { '2': true, x: { b: 2 } })

I'd expect the 2 lines that get written to the console:

info: 1 {"1":true,"x":{"a":1}}
info: 2 {"2":true,"x":{"b":2}}

In practice, I'm getting 2 identical lines:

{
  "1": true,
  "2": true,
  "x": {
    "b": 2
  }
}

image

I'm not mutating any of the logged objects and didn't see anything in the docs about auto-merging, so I'm a bit confused. This also seems to work fine with other services.

Thanks!

elsbree commented 5 years ago

We're seeing this as well- we log many lines per second, and it's seriously impacting our ability to filter logs effectively.

elsbree commented 5 years ago

I've submitted a PR to fix this, but in the meantime reverting to 2.2.0 will resolve the problem.