diff options
| author | Ben Beltran <ben@freshout.us> | 2013-06-25 12:16:02 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@freshout.us> | 2013-06-25 12:16:02 -0500 |
| commit | b39688c9e0d42361c2351a2c66068fc634cb6557 (patch) | |
| tree | d695c6f39c8e74ae8d6f1247198db7d5235c0635 | |
| parent | c315b8c3c28373aeb28889cf4b09041d98cd5320 (diff) | |
Uses global.io if no socket is provided
| -rw-r--r-- | lib/loggers/socket.js | 11 |
1 files changed, 8 insertions, 3 deletions
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); + } } } }); |