SyntaxHighlighter

Thursday, June 13, 2019

Winston v2 to v3 and Papertrail Logging


Winston is a logging library for NodeJS and has a bunch of community-built “transports” that use the Winston API to log to different places. Maybe “Console” and “Single File” while developing, and “logging service like papertrail” and “rotating log file” while in production. Code in the application “just logs” and configuration sends the messages where they should go. That how it works in our framework of choice, actionhero

Well, Winston went through a big upgrade to v3. This affected my project because the framework we were using had used Winston 2.x, and when I upgraded Node versions and our framework version, suddenly we were using Winston 3.x and my logs to papertrail stopped! We were using the Winston-papertrail transport which has been watching Winston v3 in a few different issues. While it worked, the logging looked junky because the transport was not updated and basically printed messages twice in the same log to Papertrail. Ugly, but at least functional again.

That’s where I ended yesterday and was just going to deal with it, when I found there was a v2 branch for Winston-papertrail. They say it’s not complete (some connect error cases) and I had to change my formatting a little in my application, but it works lovely and everything is back and running again. The community is slow moving on the Winston-papertrail project but it’s hanging in there and any Node project moving from v2 to v3 of Winston and wants Papertrail should be aware of it.