2
var layouts = require('../layouts')
3
, loggly = require('loggly')
5
, passThrough = layouts.messagePassThroughLayout;
9
* Loggly Appender. Sends logging events to Loggly using node-loggly
11
* @param config object with loggly configuration data
13
* token: 'your-really-long-input-token',
14
* subdomain: 'your-subdomain',
15
* tags: ['loggly-tag1', 'loggly-tag2', .., 'loggly-tagn']
17
* @param layout a function that takes a logevent and returns a string (defaults to objectLayout).
19
function logglyAppender(config, layout) {
20
var client = loggly.createClient(config);
21
if(!layout) layout = passThrough;
23
return function(loggingEvent) {
24
var msg = layout(loggingEvent);
27
level: loggingEvent.level.levelStr,
28
category: loggingEvent.categoryName,
29
hostname: os.hostname().toString(),
34
function configure(config) {
37
layout = layouts.layout(config.layout.type, config.layout);
39
return logglyAppender(config, layout);
42
exports.name = 'loggly';
43
exports.appender = logglyAppender;
44
exports.configure = configure;