From: Ben Beltran Date: Tue, 25 Jun 2013 17:16:02 +0000 (-0500) Subject: Uses global.io if no socket is provided X-Git-Tag: v1.1.0~25 X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/commitdiff_plain/b39688c9e0d42361c2351a2c66068fc634cb6557?ds=inline;hp=-c Uses global.io if no socket is provided --- b39688c9e0d42361c2351a2c66068fc634cb6557 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); + } } } });