log4js-node-amqp
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -35,2 +35,6 @@ "use strict"; | ||
process.on('exit', function() { | ||
if (connection) connection.end(); | ||
}); | ||
var onReady = function () { | ||
@@ -37,0 +41,0 @@ connection.removeListener('ready', onReady); |
{ | ||
"name": "log4js-node-amqp", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
log4js-node-amqp | ||
================ | ||
An AMQP appender for log4js-node | ||
[![Build Status](https://travis-ci.org/maxnachlinger/log4js-node-amqp.png?branch=master)](https://travis-ci.org/maxnachlinger/log4js-node-amqp) | ||
## Configuration | ||
This is a log4js appender which uses the awesome node-amqp package at: https://github.com/postwait/node-amqp | ||
## Usage: | ||
```javascript | ||
var log4js = require('log4js'); | ||
var amqpAppender = require('log4js-node-amqp'); | ||
// configure in code | ||
log4js.addAppender( | ||
amqpAppender.appender({ | ||
// more config options available | ||
connection: { | ||
url: "amqp://guest:guest@vm:5672" | ||
} | ||
}), | ||
'amqp-example' | ||
); | ||
var logger = log4js.getLogger('amqp-example'); | ||
logThings(); | ||
log4js.clearAppenders(); | ||
// or configure via configure() | ||
log4js.configure({ | ||
appenders: [ | ||
{ | ||
type: 'console' | ||
}, | ||
{ | ||
type: 'log4js-node-amqp', | ||
connection: { | ||
url: "amqp://guest:guest@vm:5672" | ||
}, | ||
category: 'amqp-example' | ||
} | ||
] | ||
}); | ||
var logger = log4js.getLogger('amqp-example'); | ||
logThings(); | ||
process.exit(); | ||
function logThings() { | ||
// strings work | ||
logger.info('a string of log data.'); | ||
// so do objects | ||
logger.info({name: 'a string', type: 'a silly example'}); | ||
} | ||
``` | ||
## License | ||
[The MIT License](http://opensource.org/licenses/MIT) | ||
Copyright (c) 2013 Max Nachlinger |
10329
7
328
60