-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
There are two main libraries used for logging in Node, pino, that Cedar already uses, and winston
They say pino is the most performant (least overhead). And it fits very well with Fastify which we already use too. Both Pino and Fastify are written by Matteo Collina, who is obviously very talented.
I just don't like the API/DX very much of Pino π Winston looks much nicer! What I want is something that looks and feels like console.log. So I for example can do this
const name = 'Joe'
const age = 47
const infoObject = {
sex: 'male',
shoeSize: 9,
children: 2,
}
logger.debug('My name is', name, 'and I am', age, 'years old. And here's some more info about me:', infoObject)
And have it printed to the terminal/browser console just as nicely as console.log would have (e.g. not doing String(infoObject))
I'm also thinking maybe Cedar could ship with a log viewer
There's this (Winston) https://github.com/errsole/errsole.js
And this (pino) https://pinorama.dev
There's also https://github.com/cabinjs/cabin that I like mostly because it's forest theme that goes very well with Cedar π²
The Cabin team also have https://github.com/cabinjs/axe/ which normalizes logging and works with Pino. I don't like everything they do, so I don't think I want to use it as-is. But maybe I can get some inspiration for how to bend Pino to my will.
And speaking of bending Pino, I also found this article: https://dev.to/vbarzana/enhancing-pino-to-support-message-payload-logging-without-breaking-pretty-logs-2hjb