Skip to content

Instantly share code, notes, and snippets.

@youurayy
Created October 11, 2011 17:43
Show Gist options
  • Save youurayy/1278817 to your computer and use it in GitHub Desktop.
Save youurayy/1278817 to your computer and use it in GitHub Desktop.
require('winston/lib/winston/transports/loggly').Loggly.prototype.log =
function(level, msg, meta, callback) {
if(this.silent)
return callback(null, true);
var self = this;
/*
message = common.clone(meta || {});
message.level = level;
message.message = msg;
*/
var message = {
message: msg,
level: level
};
if(meta)
message.meta = meta;
if(!this.ready)
this.logBuffer.push(message);
else if (this.ready && this.logBuffer.length > 0) {
this.logBuffer.push(message);
this.flush();
}
else
this.client.log(this.inputToken, message, function () {
self.emit('logged');
});
callback(null, true);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment