From: Ben Beltran Date: Tue, 25 Jun 2013 17:16:02 +0000 (-0500) Subject: Uses global.io if no socket is provided X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/commitdiff_plain/30fe40b3459eac9a7d5d2feea15abe61c9fbc456 Uses global.io if no socket is provided --- diff --git a/lib/loggers/socket.js b/lib/loggers/socket.js index 739c5b3..ea9d944 100644 --- a/lib/loggers/socket.js +++ b/lib/loggers/socket.js @@ -20,7 +20,8 @@ init : function (config) { var logger = this; - logger.socketIo = io; + + logger.socketIo = global.io if (config) { for (property in config) { @@ -28,7 +29,9 @@ } } - logger._socket = logger.socketIo.connect(logger.serverUrl); + if (logger.socketIo) { + logger._socket = logger.socketIo.connect(logger.serverUrl); + } }, log : function () { @@ -38,7 +41,9 @@ messageArray.push(arguments[i]); } - this._socket.emit('log', messageArray); + if (this._socket) { + this._socket.emit('log', messageArray); + } } } });