Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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");
// 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'));
}
.on('readable', function() {
this.stdout.pipe(pinop()).pipe(process.stdout)
this.stderr.pipe(pinop()).pipe(process.stdout)
})
// .on('crash',['clean']);
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,
};
}
const pino = require('pino');
const pretty = pino.pretty();
pretty.pipe(process.stdout)
module.exports = pino({
name: 'app',
safe: true
}, pretty);
const pino = require('pino');
const pretty = pino.pretty();
pretty.pipe(process.stdout)
module.exports = pino({
name: 'app',
safe: true
}, pretty);
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
}
init (config) {
const pretty = pino.pretty()
pretty.pipe(process.stdout)
this.pino = pino({
name: 'ark-core',
safe: true
}, pretty)
return this
}
const pino = require('pino');
const pretty = pino.pretty();
pretty.pipe(process.stdout)
module.exports = pino({
name: 'app',
safe: true
}, pretty);