Sha256: 59a61d2101332f80cc9fa9c5dd913a7d4f71bcc8899cb0f980e03857e3b5c563

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

'use strict';
var layouts = require('../layouts')
, loggly = require('loggly')
, os = require('os')
, passThrough = layouts.messagePassThroughLayout;


/**
 * Loggly Appender. Sends logging events to Loggly using node-loggly 
 *
 * @param config object with loggly configuration data
 * {
 *   token: 'your-really-long-input-token',
 *   subdomain: 'your-subdomain',
 *   tags: ['loggly-tag1', 'loggly-tag2', .., 'loggly-tagn'] 
 * }
 * @param layout a function that takes a logevent and returns a string (defaults to objectLayout).
 */
function logglyAppender(config, layout) {
	var client = loggly.createClient(config);
  if(!layout) layout = passThrough;

  return function(loggingEvent) {
		var msg = layout(loggingEvent);
		client.log({
			msg: msg,
			level: loggingEvent.level.levelStr,
			category: loggingEvent.categoryName,
			hostname: os.hostname().toString(),
		});
  }
}

function configure(config) {
	var layout;
	if (config.layout) {
		layout = layouts.layout(config.layout.type, config.layout);
	}
	return logglyAppender(config, layout);
}

exports.name      = 'loggly';
exports.appender  = logglyAppender;
exports.configure = configure;

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/log4js/lib/appenders/loggly.js