lrlna / pino-colada

cute ndjson formatter for pino 🌲🍹
MIT License
244 stars 46 forks source link

Support use as a Pino transport #48

Open segevfiner opened 2 years ago

segevfiner commented 2 years ago

pretty-print & prettifier the new recommended way of integrating a prettifier via API is using a pino.transport. pino-pretty supports this so can probably checked to see an example of how.

segevfiner commented 2 years ago

Consider using https://github.com/pinojs/pino-abstract-transport for this.

petercpwong commented 2 years ago

For anyone who's having trouble using this with the latest version of pino, here's a quick hack to get things working:

const pino = require('pino');
const pinoPretty = require('pino-pretty');
const pinoColada = require('pino-colada');

const logger = pino(
  {
    // pino options
  },
  pinoPretty({
    hideObject: true,
    levelKey: '',
    messageFormat: pinoColada(),
    singleLine: true,
    timestampKey: ''
  })
);