How to use the bunyan.resolveLevel 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 restify / node-restify / lib / bunyan_helper.js View on Github external
function RequestCaptureStream(opts) {
    assert.object(opts, 'options');
    assert.optionalObject(opts.stream, 'options.stream');
    assert.optionalArrayOfObject(opts.streams, 'options.streams');
    assert.optionalNumber(opts.level, 'options.level');
    assert.optionalNumber(opts.maxRecords, 'options.maxRecords');
    assert.optionalNumber(opts.maxRequestIds, 'options.maxRequestIds');
    assert.optionalBool(opts.dumpDefault, 'options.dumpDefault');

    var self = this;
    Stream.call(this);

    this.level = opts.level ? bunyan.resolveLevel(opts.level) : bunyan.WARN;
    this.limit = opts.maxRecords || 100;
    this.maxRequestIds = opts.maxRequestIds || 1000;
    // eslint-disable-next-line new-cap
    this.requestMap = LRU({
        max: self.maxRequestIds
    });
    this.dumpDefault = opts.dumpDefault;

    this._offset = -1;
    this._rings = [];

    this.streams = [];

    if (opts.stream) {
        appendStream(this.streams, opts.stream);
    }
github joyent / manatee / sitter.js View on Github external
(function main() {
    var _config;
    var _options = parseOptions();

    LOG.debug({options: _options}, 'command line options parsed');
    _config = readConfig(_options);
    LOG.debug({config: _config}, 'configuration loaded');

    if (_config.logLevel && !LOG_LEVEL_OVERRIDE) {
        if (bunyan.resolveLevel(_config.logLevel)) {
            LOG.level(_config.logLevel);
        }
    }


    // set loggers of the sub components
    _config.log = LOG;
    _config.postgresMgrCfg.log = LOG;
    _config.postgresMgrCfg.zfsClientCfg.log = LOG;
    _config.postgresMgrCfg.snapShotterCfg.log = LOG;

    LOG.info('starting manatee');
    var shard = Shard.start(_config);
    StatusServer.start({
        log: LOG,
        port: _config.postgresPort + 1,
github joyent / manatee / backupserver.js View on Github external
(function main() {
    var _config;
    var _options = parseOptions();

    LOG.debug({options: _options}, 'command line options parsed');
    _config = readConfig(_options);
    LOG.debug({config: _config}, 'configuration loaded');

    if (_config.logLevel && !LOG_LEVEL_OVERRIDE) {
        if (bunyan.resolveLevel(_config.logLevel)) {
            LOG.level(_config.logLevel);
        }
    }

    _config.backupServerCfg.log = LOG;
    _config.backupSenderCfg.log = LOG;

    var backupServer = BackupServer.start(_config.backupServerCfg);
    // server and sender share the same queue
    _config.backupSenderCfg.queue = backupServer.getQueue();
    BackupSender.start(_config.backupSenderCfg);

    LOG.info('backupserver started');
})();
github MadKudu / node-marketo / lib / util.js View on Github external
logger: function() {
    if (!logger) {
      logger = bunyan.createLogger({name: config.name});
      if (process.env.NODE_MARKETO_LOG_LEVEL) {
        logger.level(bunyan.resolveLevel(process.env.NODE_MARKETO_LOG_LEVEL));
      }
    }
    return logger;
  },
github restify / clients / lib / helpers / bunyan.js View on Github external
function RequestCaptureStream(opts) {
    assert.object(opts, 'options');
    assert.optionalObject(opts.stream, 'options.stream');
    assert.optionalArrayOfObject(opts.streams, 'options.streams');
    assert.optionalNumber(opts.level, 'options.level');
    assert.optionalNumber(opts.maxRecords, 'options.maxRecords');
    assert.optionalNumber(opts.maxRequestIds, 'options.maxRequestIds');
    assert.optionalBool(opts.dumpDefault, 'options.dumpDefault');

    var self = this;
    Stream.call(this);

    this.level = opts.level ? bunyan.resolveLevel(opts.level) : bunyan.WARN;
    this.limit = opts.maxRecords || 100;
    this.maxRequestIds = opts.maxRequestIds || 1000;
    this.requestMap = new LRU({
        max: self.maxRequestIds
    });
    this.dumpDefault = opts.dumpDefault;

    this._offset = -1;
    this._rings = [];

    this.streams = [];

    if (opts.stream) {
        appendStream(this.streams, opts.stream);
    }
github dadi / web / dadi / lib / log.js View on Github external
enabled: function(level) {
      return config.get('logging').enabled && (bunyan.resolveLevel(level) >= bunyan.resolveLevel(config.get('logging.level')));
    },
github joyent / moray / main.js View on Github external
streams: [ {
                level: level,
                type: 'raw',
                stream: bsyslog.createBunyanStream({
                    name: NAME,
                    facility: facility,
                    host: cfg_b.syslog.host,
                    port: cfg_b.syslog.port,
                    type: cfg_b.syslog.type
                })
            } ]
        });
    }

    if (cfg_b.level && !LOG_LEVEL_OVERRIDE) {
        if (bunyan.resolveLevel(cfg_b.level)) {
            LOG.level(cfg_b.level);
        }
    }
}
github joyent / manatee / snapshotter.js View on Github external
(function main() {
    var _config;
    var _options = parseOptions();

    LOG.debug({options: _options}, 'command line options parsed');
    _config = readConfig(_options);
    LOG.debug({config: _config}, 'configuration loaded');

    if (_config.logLevel && !LOG_LEVEL_OVERRIDE) {
        if (bunyan.resolveLevel(_config.logLevel)) {
            LOG.level(_config.logLevel);
        }
    }

    _config.log = LOG;

    var snapShotter = new SnapShotter(_config);

    snapShotter.on('error', function (err) {
        LOG.error('got error from snapshotter', err);
    });

    snapShotter.start(function () {
        LOG.info('snapshotter started');
    });
})();
github dadi / api / dadi / lib / log.js View on Github external
enabled: function(level) {
    return config.get('logging').enabled && (bunyan.resolveLevel(level) >= bunyan.resolveLevel(config.get('logging.level')));
  },