X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/blobdiff_plain/c315b8c3c28373aeb28889cf4b09041d98cd5320..5c03d3b44c5daeb34180c6922fcf3307f1217cbc:/lib/loggers/socket.js diff --git a/lib/loggers/socket.js b/lib/loggers/socket.js index 739c5b3..b057d77 100644 --- a/lib/loggers/socket.js +++ b/lib/loggers/socket.js @@ -4,6 +4,7 @@ // Load up dependencies if (typeof require === 'function') { var Ne = require('neon'); + var ioClient = require('socket.io-client'); Module = Ne.Module; Class = Ne.Class; } else { @@ -20,7 +21,6 @@ init : function (config) { var logger = this; - logger.socketIo = io; if (config) { for (property in config) { @@ -28,6 +28,10 @@ } } + if (!logger.socketIo) { + logger.socketIo = ioClient; + } + logger._socket = logger.socketIo.connect(logger.serverUrl); }, @@ -38,7 +42,9 @@ messageArray.push(arguments[i]); } - this._socket.emit('log', messageArray); + if (this._socket) { + this._socket.emit('log', messageArray); + } } } });