X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/blobdiff_plain/b69497efe78c60742e0bb7ab5fed2b94ce89682e..be6c04cd7e8e1b02ed3b247f9fd45c60c907d43e:/lib/loggers/socket.js?ds=sidebyside diff --git a/lib/loggers/socket.js b/lib/loggers/socket.js index 8d0ff55..739c5b3 100644 --- a/lib/loggers/socket.js +++ b/lib/loggers/socket.js @@ -18,16 +18,35 @@ prototype : { serverUrl : '/', - init : function () { - this._socket = io.connect(this.serverUrl); + init : function (config) { + var logger = this; + logger.socketIo = io; + + if (config) { + for (property in config) { + logger[property] = config[property]; + } + } + + logger._socket = logger.socketIo.connect(logger.serverUrl); }, - log : function (logObject) { - this._socket.emit('log', logObject); + log : function () { + var i, messageArray = []; + + for (i = 0; i < arguments.length; i++) { + messageArray.push(arguments[i]); + } + + this._socket.emit('log', messageArray); } } }); + if (Cobalt.Logger.Socket.__objectSpy) { + Cobalt.Logger.Socket.__objectSpy.destroy(); + } + if (typeof require === 'function') { global.Socket = Cobalt.Logger.Socket; } else {