How to use the bunyan.FATAL 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 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 ericelliott / bunyan-request-logger / test / log.route.js View on Github external
describe('bunyan-request-logger log.gif', function () {
  var infoSpy;
  var app = createDefaultApp({level: bunyan.FATAL});

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

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

  after(function () {
    infoSpy.restore();
  });

  describe('logging', function () {

    it('should log the request id in the response at the info level', function (done) {
github RethinkRobotics-opensource / rosnodejs / test / Log.js View on Github external
expect(outputCapture.get().level).to.equal(bunyan.INFO);

    reset();
    rosnodejs.log.warn(message);
    expect(outputCapture.get().msg).to.have.string(message);
    expect(outputCapture.get().level).to.equal(bunyan.WARN);

    reset();
    rosnodejs.log.error(message);
    expect(outputCapture.get().msg).to.have.string(message);
    expect(outputCapture.get().level).to.equal(bunyan.ERROR);

    reset();
    rosnodejs.log.fatal(message);
    expect(outputCapture.get().msg).to.have.string(message);
    expect(outputCapture.get().level).to.equal(bunyan.FATAL);

    reset();
    rosnodejs.log.traceThrottle(1, message);
    expect(outputCapture.get().msg).to.have.string(message);
    expect(outputCapture.get().level).to.equal(bunyan.TRACE);

    reset();
    rosnodejs.log.debugThrottle(1, message);
    expect(outputCapture.get().msg).to.have.string(message);
    expect(outputCapture.get().level).to.equal(bunyan.DEBUG);

    reset();
    rosnodejs.log.infoThrottle(1, message);
    expect(outputCapture.get().msg).to.have.string(message);
    expect(outputCapture.get().level).to.equal(bunyan.INFO);
github eclipse-theia / theia / packages / bunyan / src / node / bunyan-logger-server.ts View on Github external
protected toBunyanLevel(logLevel: number): number {
        switch (logLevel) {
            case LogLevel.FATAL:
                return bunyan.FATAL;
            case LogLevel.ERROR:
                return bunyan.ERROR;
            case LogLevel.WARN:
                return bunyan.WARN;
            case LogLevel.INFO:
                return bunyan.INFO;
            case LogLevel.DEBUG:
                return bunyan.DEBUG;
            case LogLevel.TRACE:
                return bunyan.TRACE;
            default:
                return bunyan.INFO;
        }
    }
github imodeljs / imodeljs / core / logger-config / src / FluentdLoggerStream.ts View on Github external
response = "Debug";
        break;
      }
      case bunyan.INFO: {
        response = "Information";
        break;
      }
      case bunyan.WARN: {
        response = "Warning";
        break;
      }
      case bunyan.ERROR: {
        response = "Error";
        break;
      }
      case bunyan.FATAL: {
        response = "Fatal";
        break;
      }
      default: {
        response = "Information";
      }
    }
    return response;
  }
github joyent / manatee-state-machine / lib / stream-bunyan-prettyprint.js View on Github external
BunyanPrettyPrinter.prototype._transform = function (chunk, _, callback)
{
	var component = chunk.component || chunk.name;
	var message = chunk.msg;
	var stream = this;
	var level;

	switch (chunk.level) {
	case mod_bunyan.TRACE:		level = 'TRACE'; break;
	case mod_bunyan.DEBUG:		level = 'DEBUG'; break;
	case mod_bunyan.INFO:		level = 'INFO';  break;
	case mod_bunyan.WARN:		level = 'WARN';  break;
	case mod_bunyan.ERROR:		level = 'ERROR'; break;
	case mod_bunyan.FATAL:		level = 'FATAL'; break;
	default:			level = '?????'; break;
	}

	this.push(sprintf('[%5s] %s: %s\n', level, component, message));

	mod_jsprim.forEachKey(chunk, function (key, value) {
		if (bunyanStdKeys.hasOwnProperty(key))
			return;
		stream.push(sprintf('  %10s: %j\n', key, value));
	});

	callback();
};
github hipages / inceptum / src / log / LogManager.ts View on Github external
private static levelSerialiser(level) {
    switch (level) {
      case bunyan.TRACE:
        return 'TRACE';
      case bunyan.DEBUG:
        return 'DEBUG';
      case bunyan.INFO:
        return 'INFO';
      case bunyan.WARN:
        return 'WARN';
      case bunyan.ERROR:
        return 'ERROR';
      case bunyan.FATAL:
        return 'FATAL';
      default:
        return 'N/A';
    }
  }
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 nusmodifications / nusmods / api / __mocks__ / bunyan.js View on Github external
mockedBunyan.createLogger = ({ level, ...otherConfig }) => bunyan.createLogger({
  ...otherConfig,
  level: bunyan.FATAL,
});