Lua and PM2

I've been using PM21 for quite some time now to manage services written in Lua.
How does that work you ask?

pm2 start server.lua --name "web" --interpreter luajit

Only downside? No live output in logs. Quite odd.
I started to hack io.stdout and it's metatable but quickly found the proper solution:


And with that you can use pm2 logs web to have a neat live feed.