How to use the pino.pretty 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 flow-typed / flow-typed / definitions / npm / pino_v3.x.x / test_pino_v3.js View on Github external
const p: Logger = pino();

p.info("hello world");
p.error("this is at error level");
p.info("the answer is %d", 42);
p.info({ obj: 42 }, "hello world");
p.info({ obj: 42, b: 2 }, "hello world");
p.info({ obj: { aa: "bbb" } }, "another");
setImmediate(p.info, "after setImmediate");
p.error(new Error("an error"));

// $ExpectError
p("no log level");

const pretty = pino.pretty();
pretty.pipe(process.stdout);
const log = pino(
  {
    name: "app",
    safe: true
  },
  pretty
);

log.child({ widget: "foo" }).info("hello");
log.child({ widget: "bar" }).warn("hello 2");
github paritytech / fether / packages / fether-electron / src / main / app / utils / pino.js View on Github external
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause

import { app } from 'electron';
import fs from 'fs';
import { multistream } from 'pino-multi-stream';
import Pino from 'pino';

import { name } from '../../../../package.json';

// Pino by default outputs JSON. We prettify that.
const pretty = Pino.pretty();
pretty.pipe(process.stdout);

const streams = [];

// In production, create 2 output streams:
// - fether.log file (raw JSON)
// - stdout (prettified output)
const IS_TEST = !app;

if (!IS_TEST) {
  // Create userData folder if it doesn't exist
  try {
    fs.statSync(app.getPath('userData'));
  } catch (e) {
    fs.mkdirSync(app.getPath('userData'));
  }
github rockstat / front / gulpfile.js View on Github external
.on('readable', function() {
    this.stdout.pipe(pinop()).pipe(process.stdout)
    this.stderr.pipe(pinop()).pipe(process.stdout)
  })
  // .on('crash',['clean']);
github TrueCar / gluestick / packages / gluestick / src / lib / server / logger.js View on Github external
export function getLogConfig(config = {}) {
  let pretty = null;
  let cliOptions = {};

  if (process.env.GS_COMMAND_OPTIONS) {
    cliOptions = parseLogOptions(process.env.GS_COMMAND_OPTIONS);
  }

  if ({}.hasOwnProperty.call(cliOptions, 'pretty') && cliOptions.pretty !== true) {
    pretty = null;
  } else if (!!config.pretty || cliOptions.pretty === true) {
    pretty = pino.pretty();
    pretty.pipe(process.stdout);
  }

  return {
    logConfig: { ...pinoBaseConfig, ...config, ...cliOptions },
    prettyConfig: pretty,
  };
}
github battila7 / brocan / components / services / bond / src / logger.js View on Github external
const pino = require('pino');
const pretty = pino.pretty();

pretty.pipe(process.stdout)

module.exports = pino({
  name: 'app',
  safe: true
}, pretty);
github battila7 / brocan / components / services / identity / src / logger.js View on Github external
const pino = require('pino');
const pretty = pino.pretty();

pretty.pipe(process.stdout)

module.exports = pino({
  name: 'app',
  safe: true
}, pretty);
github ArkEcosystem / core / packages / core-logger-pino / lib / driver.js View on Github external
make (options) {
    const pretty = pino.pretty()
    pretty.pipe(process.stdout)

    this.driver = pino(options, pretty)
    this.driver.printTracker = this.printTracker
    this.driver.stopTracker = this.stopTracker

    return this.driver
  }
github ArkEcosystem / core / packages / core-logger-pino / src / logger.js View on Github external
init (config) {
    const pretty = pino.pretty()
    pretty.pipe(process.stdout)

    this.pino = pino({
      name: 'ark-core',
      safe: true
    }, pretty)

    return this
  }
github battila7 / brocan / components / services / origins / src / logger.js View on Github external
const pino = require('pino');
const pretty = pino.pretty();

pretty.pipe(process.stdout)

module.exports = pino({
  name: 'app',
  safe: true
}, pretty);