How to use the bunyan.INFO function in bunyan

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 RethinkRobotics-opensource / rosnodejs / src / utils / log / ConsoleLogStream.js View on Github external
if (typeof rec === 'string' || rec instanceof String) {
      console.log(rec);
      return;
    }
    else if (typeof rec === 'object') {
      const formattedMsg = this._formatter(rec);
      if (typeof formattedMsg === 'string' || formattedMsg instanceof String) {
        msg = formattedMsg;
      }
      else {
        console.error('Unable to format message %j', rec);
        return;
      }

      const logLevel = rec.level;
      if (logLevel <= bunyan.INFO) {
        console.info(msg);
      }
      else if (logLevel <= bunyan.WARN) {
        console.warn(msg);
      }
      else { // logLevel === bunyan.ERROR || bunyan.FATAL
        console.error(msg);
      }
    }
  }
};
github jsdelivr / data.jsdelivr.com / src / lib / logger / index.js View on Github external
level: OpbeatStream.levels[record.level],
			}, _.omit(record, [ 'err', 'level', 'name', 'req', 'v' ])));

			global.OPBEAT_CLIENT.captureError(record.err);
		} else {
			global.OPBEAT_CLIENT.setExtraContext(_.assign({
				level: OpbeatStream.levels[record.level],
			}, _.omit(record, [ 'level', 'name', 'v' ])));
		}
	}
}

OpbeatStream.levels = {
	[bunyan.TRACE]: 'debug',
	[bunyan.DEBUG]: 'debug',
	[bunyan.INFO]: 'info',
	[bunyan.WARN]: 'warning',
	[bunyan.ERROR]: 'error',
	[bunyan.FATAL]: 'fatal',
};

module.exports = bunyan.createLogger({
	name: 'app-log',
	streams: process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test' ? [
		{ level: bunyan.TRACE, type: 'raw', stream: prettyStream },
	] : [
		{ level: bunyan.TRACE, type: 'raw', stream: new FileStream(path.join(loggerConfig.path, process.pid + '.log')) },
		// { level: bunyan.TRACE, type: 'raw', stream: new OpbeatStream() },
	],
	serializers: _.defaults({
		err (err) {
			return err;
github philipcmonk / plogging / index.js View on Github external
////////////////////////////////////////////////////////

var bunyan = require('bunyan');
var log = bunyan.createLogger({
  src: true,
  name: 'life',
  streams: [{
    type: 'rotating-file',
    path: './log',
    count: 100
  }, {
    stream: process.stdout
  }]
});

log.level(bunyan.INFO);

var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser());
//app.use(bodyParser.urlencoded({extended: true}));

var uuidGen = require('node-uuid');

var sugar = require('sugar');

////////////////////////////////////////////////////////
// Mod                                                //
////////////////////////////////////////////////////////

// Modifier of any sort.  Usually an adpositional phrase.
github e2ebridge / bpmn / lib / utils / bunyan2winston.js View on Github external
Bunyan2Winston.prototype.write = function write(rec) {
    // Map to the appropriate Winston log level (by default 'info', 'warn'
    // or 'error') and call signature: `wlog.log(level, msg, metadata)`.
    var wlevel;
    if (rec.level <= bunyan.INFO) {
        wlevel = 'info';
    } else if (rec.level <= bunyan.WARN) {
        wlevel = 'warn';
    } else {
        wlevel = 'error';
    }

    // Note: We are *modifying* the log record here. This could be a problem
    // if our Bunyan logger had other streams. This one doesn't.
    var msg = rec.msg;
    delete rec.msg;

    // Remove internal bunyan fields that won't mean anything outside of
    // a bunyan context.
    delete rec.v;
    delete rec.level;
github RethinkRobotics-opensource / rosnodejs / test / Log.js View on Github external
it('Throttling', () => {
    const message = 'This is my message';
    reset();
    rosnodejs.log.infoThrottle(1000, message);
    expect(outputCapture.get().msg).to.have.string(message);
    expect(outputCapture.get().level).to.equal(bunyan.INFO);

    outputCapture.flush();
    rosnodejs.log.infoThrottle(1000, message);
    expect(outputCapture.get()).to.be.null;
  });
github bkonkle / reactifier / src / create-logger.js View on Github external
PlainStream.prototype.write = rec => {
  const message = rec.msg

  if (rec.level < bunyan.INFO) {
    console.log(message)
  } else if (rec.level < bunyan.WARN) {
    console.info(message)
  } else if (rec.level < bunyan.ERROR) {
    console.warn(message)
  } else {
    if (rec.err && rec.err.stack) {
      console.error(rec.err.stack)
    } else {
      console.log(chalk.red(message))
    }
  }
}
github eclipse-theia / theia / packages / bunyan / src / node / bunyan-logger-server.ts View on Github external
protected toTheiaLevel(bunyanLogLevel: number | string): number {
        switch (Number(bunyanLogLevel)) {
            case bunyan.FATAL:
                return LogLevel.FATAL;
            case bunyan.ERROR:
                return LogLevel.ERROR;
            case bunyan.WARN:
                return LogLevel.WARN;
            case bunyan.INFO:
                return LogLevel.INFO;
            case bunyan.DEBUG:
                return LogLevel.DEBUG;
            case bunyan.TRACE:
                return LogLevel.TRACE;
            default:
                return LogLevel.INFO;
        }
    }
github mozilla / web-ext / src / util / logger.js View on Github external
write(
    packet: BunyanLogEntry,
    {localProcess = process}: ConsoleOptions = {}
  ): void {
    const thisLevel: BunyanLogLevel = this.verbose ? bunyan.TRACE : bunyan.INFO;
    if (packet.level >= thisLevel) {
      const msg = this.format(packet);
      if (this.isCapturing) {
        this.capturedMessages.push(msg);
      } else {
        localProcess.stdout.write(msg);
      }
    }
  }
github marsinvasion / yalv / logGenerator / generate.js View on Github external
var logStr = function(type,request,api,func){
  if(bunyan.INFO === logger.levels(0)){
    logger.info({type:type, request:request,api:api,func:func});
  }
}