logger-facade-airbrake-plugin

Logger Facade Airbrake Plugin

Usage no npm install needed!

<script type="module">
  import loggerFacadeAirbrakePlugin from 'https://cdn.skypack.dev/logger-facade-airbrake-plugin';
</script>

README

Build Status Code Climate Coverage Dependency Status Grunt

Logger Facade Airbrake plugin for Nodejs

version

Simple node module to log errors on Airbrake using logger facade.

This simple logger facade allows pluggin hook to execute different logging.

How to use it

Install it:

npm install logger-facade-nodejs
npm install logger-facade-airbrake-plugin

Set up plugins and log errors

var Logger = require('logger-facade-nodejs');
var LoggerAirbrakePlugin = require('logger-facade-airbrake-plugin');

console.log("Start sample of Async error Log...");

var config = {
  //api key, default (null)
  apiKey: "apikey",
  // host, default (null)
  host: "api.airbrake.io",
  // port, default (80)
  port: 80,
  // protocol, default (http)
  protocol: 'http',
  // notify uncaught excpetions, default (false)
  notifyUncaughtException: false,
  // dev envs, default (['development', 'test'])
  developmentEnvironments: ['development', 'test'],
  // appVersion, default (null)
  appVersion: null
};

var plugin = new LoggerAirbrakePlugin(config);
Logger.use(plugin);

console.log("Plugins: ", Logger.plugins());

var log = Logger.getLogger("Name");
log.error("Message to log %s", 'with args');

console.log("End sample...");

Download the code from this gist.

Contribution

Bug fixes and new features are of course very welcome!

To get started developing:

  • Install Grunt
  • Install dependencies with npm install
  • Run the test suite with npm test

Please accompany any Pull Requests with the relevant test cases and make sure everything else still passes :).

Contribution Flow

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Bump versioning

We use grunt bump package to control package versioning.

Bump Patch version

$ grunt bump

Bump Minor version

$ grunt bump:minor

Bump Major version

$ grunt bump:major

Running Specs

$ npm test

Coverage Report

We aim for 100% coverage and we hope it keeps that way! :) We use pre-commit and pre-push hooks and CI to accomplish this, so don't mess with our build! :P

Check the report after running npm test.

$ open ./coverage/lcov-report/index.html

Credits

Shout out to @pjanuario.