Simple node module to log errors on Airbrake using logger facade.
This simple logger facade allows pluggin hook to execute different logging.
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.
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 :).
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
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
$ npm test
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
Shout out to @pjanuario.