Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
donuts236725y@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
-
@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 -
donuts236725y@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...
-
@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 -
donuts236725y@Commodore the start of each line is standard and insides timestamp, server, userid. The text is generated by a string.join()
Does anyone use Winston JSON? or know what the perfomance impact is vs standard text logging? (serializing an object to JS)?
question