From 7356e0bafeb3843d6c457c654abc7a68f999cf44 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Fri, 12 Dec 2014 12:11:26 +0100 Subject: [PATCH] feat(loggly): add loggly --- package.json | 1 + src/logging.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/package.json b/package.json index 061d4a227e..6f14a60e51 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "jade": "~1.7.0", "js2xmlparser": "~0.1.2", "lodash": "~2.4.1", + "loggly": "~1.0.8", "method-override": "~2.2.0", "moment": "~2.8.3", "mongoose": "~3.8.17", diff --git a/src/logging.js b/src/logging.js index 5e1449db3d..07e795e137 100644 --- a/src/logging.js +++ b/src/logging.js @@ -3,6 +3,19 @@ var winston = require('winston'); require('winston-mail').Mail; require('winston-newrelic'); +var loggly = require('loggly').createClient({ + token: nconf.get('LOGGLY:token'), + subdomain: nconf.get('LOGGLY:subdomain'), + auth: { + username: nconf.get('LOGGLY:username'), + password: nconf.get('LOGGLY:password') + }, + // + // Optional: Tag to send with EVERY log message + // + tags: ['heroku'] +}); + var logger; if (logger == null) { @@ -49,3 +62,8 @@ module.exports.error = function(/* variable args */) { if (logger) logger.error.apply(logger, arguments); }; + +module.exports.loggly = function(/* variable args */){ + if(loggly) + loggly.log(loggly, arguments); +};