Comment by theogravity

Comment by theogravity 3 days ago

0 replies

Neat. It looks like it's more focused on the visual side of things since the screenshot shows two different ways to visually output the results?

I wrote a universal logger that we've been using for our production systems for years that piggybacks on top of bunyan / console / etc. It's pretty much an abstraction layer that provides more structure to logs.

It allows us to easily swap between different logging libs without having to change our entire codebase. For example, we originally started with roarr then eventually migrated to pino, and it was just a few lines of re-config to do so with loglayer.

You use the existing config of your logging library and just feed the instance of it to loglayer.

https://github.com/theogravity/loglayer

It basically prevents problems like this:

  // Using `winston`:
  winston.info('my message', { some: 'data' })

  // Using `bunyan`:
  bunyan.info({ some: 'data' }, 'my message')
to:

  logLayer
    .withMetadata({ some: 'data'})
    .withError(new Error('test'))
    .info('my message')

A common use case is using loglayer + console initially, then swapping to something like pino later on.