Saturday, May 17, 2014

Socket.io: Sending logs to a file

It's quite simple to send the console messages from socket.io to a file. I followed this tutorial (http://masashi-k.blogspot.mx/2013/02/logger-for-socketio-save-it-into-redis.html) and the steps are:

1) Install winston
2) Configure the logger output file
3) Link the logger to socket.io using this code:


 var io = require('socket.io').listen(server, {
      logger : logger
    });

No comments: