Monday 12 June 2017

amqp.node library, viewing error

I'm trying to use amqp.node library to connect to rabbit through SSL and according to the doc: http://www.squaremobius.net/amqp.node/ssl.html you should pass console.warn to the then callback. In the project I just started work on (my first node project), we are using winston logger. So how do I actually see the error because when I do,

var opts = { }; // my ssl info
amqplib.connect("ampws://{user}:{pass}@{host}:{port}", opts).then(function(err, conn) {
    if (err) {
        winstonLogger.error("err: " + err) // this just prints [object Object]
    }
}).then(null, console.warn);

I'm not sure how to map the console.warn to my actual logger.



via Crystal

No comments:

Post a Comment