ryankurte / winston-cluster

Winston transport for Node.js clustering
MIT License
7 stars 5 forks source link

winston-cluster does not seem to work with winston version 3.0.0 #10

Open iasna opened 6 years ago

iasna commented 6 years ago

I'm trying to use winston-cluster 0.2.1 version and following the example you have given but I'm continuously getting an error

TypeError: winston.transports.Cluster is not a constructor

If I run it with winston 2.4.1 the example works.

ryankurte commented 6 years ago

Hmm, from the transport docs it looks like the approach to binding external transports has changed, and they're using the new ECMAScript 2015 classes for extensions.

Binding from the transport docs:

  var Mail = require('winston-mail').Mail;
  winston.add(Mail, options);

You might be able to try binding that way, but I suspect this might need a refactor to bring it inline with winston@3.0 transports. I don't have time to update it at the moment, but would be very happy to land a PR ^_^

kukinsula commented 6 years ago

Hello,

I am using your lib and I recently upgraded winston to version 3. Since then, I get a warning message at startup :

cluster is a legacy winston transport. Consider upgrading: Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md

Everything works fine with a node cluster, that's just a warning message in my case.

Anyway, if it can help I found that in the documentation to make custom transports work with winston 3 : https://github.com/winstonjs/winston#adding-custom-transports

ralphschuler commented 5 years ago

I just ported this to Winston 3.0.0 PR: https://github.com/ryankurte/winston-cluster/pull/13

i hope it works as good for you as it does for me :)