How to use bunyan - 10 common examples

To help you get started, we’ve selected a few bunyan 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 hyperledger / fabric-sdk-node / test / unit / logger.js View on Github external
test('\n\n ** Logging utility tests - test setting an external logger based on bunyan **\n\n', (t) => {
	console.log(' ***** logger.js - test bunyan *****'); // eslint-disable-line

	const logger = bunyan.createLogger({name: 'bunyanLogger'});
	hfc.setLogger(logger);

	testLogger(t);
	t.end();
});
github joyent / moray / test / load / manta1027.js View on Github external
if (cluster.isMaster) {
        // Fork workers.
        for (var i = 0; i < numCPUs; i++) {
                cluster.fork();
        }

        cluster.on('exit', function (worker, code, signal) {
                console.log('worker ' + worker.process.pid + ' died');
        });
} else {
        var client = moray.createClient({
                log: bunyan.createLogger({
                        level: 'warn',
                        name: 'manta1027',
                        stream: process.stdout,
                        serializers: bunyan.stdSerializers
                }),
                url: process.env.MORAY_URL
        });

        client.once('connect', function () {
                function put() {
                        client.putObject('manta', '1027', {}, function (err) {
                                if (err) {
                                        console.error(err.stack);
                                }
                                put(i);
                        });
                }

                var max = parseInt(process.env.MANTA1027_CONCURRENCY || 20, 10);
                console.log('running...');
github ericelliott / bunyan-request-logger / test / index.js View on Github external
describe('bunyan-request-logger', function () {
  var infoSpy;
  var errorSpy;
  var app = createDefaultApp({level: bunyan.FATAL});

  before(function () {
    infoSpy = sinon.spy(bunyan.prototype, 'info');
    errorSpy = sinon.spy(bunyan.prototype, 'error');

    // hide console errors while running the tests
    sinon.stub(console, 'error');
  });

  beforeEach(function () {
    infoSpy.reset();
    errorSpy.reset();
  });

  after(function () {
    infoSpy.restore();
github koajs / bunyan-logger / test / index.js View on Github external
beforeEach(async () => {
    app = new Koa();
    app.on('error', () => {}); // suppress errors

    ringBuffer = new bunyan.RingBuffer({limit: 100});
    ringLogger = bunyan.createLogger({
      name: 'test',
      streams: [{
        type: 'raw',
        stream: ringBuffer,
        level: 'trace'
      }]
    });
  });
github ericelliott / bunyan-request-logger / test / index.js View on Github external
before(function () {
    infoSpy = sinon.spy(bunyan.prototype, 'info');
    errorSpy = sinon.spy(bunyan.prototype, 'error');

    // hide console errors while running the tests
    sinon.stub(console, 'error');
  });
github ericelliott / bunyan-request-logger / test / index.js View on Github external
before(function () {
    infoSpy = sinon.spy(bunyan.prototype, 'info');
    errorSpy = sinon.spy(bunyan.prototype, 'error');

    // hide console errors while running the tests
    sinon.stub(console, 'error');
  });
github flow-typed / flow-typed / definitions / npm / bunyan_v1.x.x / test_bunyan_v1.x.x.js View on Github external
logger.trace('Foobar');

const g: void = logger.trace('foobar');

logger.trace({ err: new Error('type') }, 'messages');
const sf = logger.trace(new Error('ASDF'));
const t  = logger.trace(new Error('asdf'));

const s = logger.trace({}, false);
const b: boolean = logger.trace();
logger.trace('foo', new Error('foo'));

// $ExpectError
const v: number = Bunyan.VERSION;

Bunyan.safeCycles()('true', false);

const consoleRawStream = new Bunyan.ConsoleRawStream()

// $ExpectError
consoleRawStream.write({ level: false })

// $ExpectError
logger.log()

// $ExpectError
logger.addSTream();

logger.trace({ err: new Error('foobar') }, 'error');

Bunyan.createLogger({
    name: 'foo',
github flow-typed / flow-typed / definitions / npm / bunyan_v1.x.x / test_bunyan_v1.x.x.js View on Github external
const g: void = logger.trace('foobar');

logger.trace({ err: new Error('type') }, 'messages');
const sf = logger.trace(new Error('ASDF'));
const t  = logger.trace(new Error('asdf'));

const s = logger.trace({}, false);
const b: boolean = logger.trace();
logger.trace('foo', new Error('foo'));

// $ExpectError
const v: number = Bunyan.VERSION;

Bunyan.safeCycles()('true', false);

const consoleRawStream = new Bunyan.ConsoleRawStream()

// $ExpectError
consoleRawStream.write({ level: false })

// $ExpectError
logger.log()

// $ExpectError
logger.addSTream();

logger.trace({ err: new Error('foobar') }, 'error');

Bunyan.createLogger({
    name: 'foo',
    serializers: {
        foo(data) {
github flow-typed / flow-typed / definitions / npm / bunyan_v1.x.x / test_bunyan_v1.x.x.js View on Github external
const child = logger.child({});

logger.trace('Foobar');

const g: void = logger.trace('foobar');

logger.trace({ err: new Error('type') }, 'messages');
const sf = logger.trace(new Error('ASDF'));
const t  = logger.trace(new Error('asdf'));

const s = logger.trace({}, false);
const b: boolean = logger.trace();
logger.trace('foo', new Error('foo'));

// $ExpectError
const v: number = Bunyan.VERSION;

Bunyan.safeCycles()('true', false);

const consoleRawStream = new Bunyan.ConsoleRawStream()

// $ExpectError
consoleRawStream.write({ level: false })

// $ExpectError
logger.log()

// $ExpectError
logger.addSTream();

logger.trace({ err: new Error('foobar') }, 'error');
github joyent / manatee / lib / pg_dump / mmkdir.js View on Github external
opts.host = option.optarg;
                        break;

                case 'k':
                        opts.keyPath = option.optarg;
                        break;

                case 'u':
                        opts.url = url.parse(option.optarg).href;
                        break;

                case 'v':
                        // Allows us to set -vvv -> this little hackery
                        // just ensures that we're never < TRACE
                        LOG.level(Math.max(bunyan.TRACE, (LOG.level() - 10)));
                        if (LOG.level() <= bunyan.DEBUG)
                                LOG = LOG.child({src: true});
                        break;

                default:
                        process.exit(1);
                        break;
                }

        }

        if (!opts.url && !process.env.MANTA_URL)
                usage('url is a required argument');

        if (!opts.user && !process.env.MANTA_USER)
                usage('account is a required argument');