2
donuts
5y

Does anyone use Winston JSON? or know what the perfomance impact is vs standard text logging? (serializing an object to JS)?

Comments
  • 0
    Don't use it against Bastion or Reaper
  • 0
    @RememberMe what's that? I want to create a JS object with the data I want logged from the request object, and it serializes each of these to a file for ELK
  • 0
    @billgates if you haven't invested too much in Winston yet, you might wanna have a look at pino: https://www.npmjs.com/package/pino
    which is a performance oriented logging library.

    Small excerpt from their benchmark page:
    BunyanObj average: 564.363ms
    WinstonObj average: 464.824ms
    BoleObj average: 230.220ms
    LogLevelObject average: 474.857ms
    PinoObj average: 201.442ms
    PinoUnsafeObj average: 202.687ms
    PinoExtremeObj average: 108.689ms
    PinoUnsafeExtremeObj average: 106.718ms
  • 1
    @Commodore we can't switch now but I'm wondering if json will be faster just because is has to concatenate less info than our current string logger...
  • 0
    @billgates oh you mean a JSON.stringfy vs a custom method cherry picking attributes and concatenating them?

    If so, it sounds like something you could (and definitely should) benchmark yourself
  • 0
    @Commodore the start of each line is standard and insides timestamp, server, userid. The text is generated by a string.join()
Add Comment