How to use the pino.destination function in pino

To help you get started, we’ve selected a few pino examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kanongil / nipo / lib / index.js View on Github external
const fast = function (stream) {

        // Use fast variant if write method has _not_ been modified

        return stream.hasOwnProperty('write') ? stream : Pino.destination(stream.fd);
    };
github fastify / fastify / lib / logger.js View on Github external
function createPinoLogger (opts, stream) {
  stream = stream || opts.stream
  delete opts.stream

  if (stream && opts.file) {
    throw new FST_ERR_LOG_INVALID_DESTINATION()
  } else if (opts.file) {
    // we do not have stream
    stream = pino.destination(opts.file)
    delete opts.file
  }

  var prevLogger = opts.logger
  var prevGenReqId = opts.genReqId
  var logger = null

  if (prevLogger) {
    opts.logger = undefined
    opts.genReqId = undefined
    // we need to tap into pino internals because in v5 it supports
    // adding serializers in child loggers
    if (prevLogger[serializersSym]) {
      opts.serializers = Object.assign({}, opts.serializers, prevLogger[serializersSym])
    }
    logger = prevLogger.child(opts)
github JasonBoy / koa-web-kit / services / logger.js View on Github external
createLogger(options = {}, destination) {
    return pino(
      Object.assign(this.pinoOptions, options),
      destination || pino.destination(path.join(logPath, 'app.log'))
    );
  }
github jhwohlgemuth / tomo-cli / src / components.js View on Github external
export const CommandError = errors => {
    const log = pino(
        {prettyPrint: {levelFirst: true}},
        pino.destination('./tomo-errors.txt')
    );
    useEffect(() => {
        log.error(errors);
    }, []);
    return 
        
        ↳{space}Details written to ./tomo-errors.txt
    ;
};
export const Debug = ({data, title}) => {
github JasonBoy / koa-web-kit / services / logger.js View on Github external
createRequestsLogger(options, destination) {
    return koaPinoLogger(
      Object.assign(
        {
          logger: this.createLogger(
            options,
            destination || pino.destination(path.join(logPath, 'requests.log'))
          ),
          serializers: {
            req: pino.stdSerializers.req,
            res: pino.stdSerializers.res,
          },
        },
        options
      )
    );
  }