winstonjs / winston-loggly

A Loggly transport for winston
http://github.com/indexzero/winston-loggly
MIT License
85 stars 111 forks source link

Handle loggly errors #3

Open naholyr opened 12 years ago

naholyr commented 12 years ago

Currently, there is absolutely no error handling:

    this.client.log(this.inputToken, message, function () {
      self.emit('logged');
      callback(null, true);
    });

Today I face (not sure if it's usual with Loggly, I use it only very recently) a lot of "Error: socket hang up" errors. At least half of my events are not sent, and there is no way I can know it from the transport :(

You could change this part to something like this so we can plug to "error" event:

    this.client.log(this.inputToken, message, function (err) {
      self.emit(err ? 'error' : 'logged', err);
      callback(err, !!err);
    });

Or at least pass err to callback so we can catch it and re-call log().

perevernihata commented 8 years ago

+1 to @naholyr , 4 years passed but this code is still in the repo and being a real pain.