diff --git a/lib/appenders/loggly.js b/lib/appenders/loggly.js index 9cd19f3..9ab4047 100644 --- a/lib/appenders/loggly.js +++ b/lib/appenders/loggly.js @@ -18,24 +18,18 @@ var layouts = require('../layouts') */ function logglyAppender(config, layout) { var client = loggly.createClient(config); + if(!layout) layout = passThrough; - function packageMessage(loggingEvent) { - function BaseItem(level, msg) { - this.level = level || loggingEvent.level.toString(); - this.category = loggingEvent.categoryName; - this.hostname = os.hostname().toString(); - if (typeof msg !== 'undefined') - this.msg = msg; - }; - - var formattedMsg = passThrough(loggingEvent); - return new BaseItem(formattedMsg); - }; - - return function(loggingEvent) { - var a = layout ? layout(loggingEvent) : packageMessage(loggingEvent); - client.log(a, config.tags); - }; + return function(loggingEvent) { + console.log('logging ', loggingEvent); + var msg = layout(loggingEvent); + client.log({ + msg: msg, + level: loggingEvent.level.levelStr, + category: loggingEvent.categoryName, + hostname: os.hostname().toString(), + }); + } } function configure(config) {