X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/blobdiff_plain/8da0b42efdcb76752d822b0ce7131d792d223be3..97a7ece70e89b973468b62e1775a33762a37258e:/lib/loggers/socket.js?ds=inline diff --git a/lib/loggers/socket.js b/lib/loggers/socket.js index b057d77..7066274 100644 --- a/lib/loggers/socket.js +++ b/lib/loggers/socket.js @@ -1,61 +1,37 @@ -(function (global) { - var Module, Class; - - // Load up dependencies - if (typeof require === 'function') { - var Ne = require('neon'); - var ioClient = require('socket.io-client'); - Module = Ne.Module; - Class = Ne.Class; - } else { - Module = global.Module; - Class = global.Class; - } - - var Cobalt = {}; - Module(Cobalt, 'Logger')({}); +if (typeof require === 'function') { + var ioClient = require('socket.io-client'); +} - Cobalt.Logger.Socket = Class(Cobalt.Logger, 'Socket')({ - prototype : { - serverUrl : '/', +Class(Cobalt.Logger, 'Socket')({ + prototype : { + serverUrl : '/', - init : function (config) { - var logger = this; + init : function (config) { + var logger = this; - if (config) { - for (property in config) { - logger[property] = config[property]; - } + if (config) { + for (property in config) { + logger[property] = config[property]; } + } - if (!logger.socketIo) { - logger.socketIo = ioClient; - } + if (!logger.socketIo) { + logger.socketIo = ioClient; + } - logger._socket = logger.socketIo.connect(logger.serverUrl); - }, + logger._socket = logger.socketIo.connect(logger.serverUrl); + }, - log : function () { - var i, messageArray = []; + log : function () { + var i, messageArray = []; - for (i = 0; i < arguments.length; i++) { - messageArray.push(arguments[i]); - } + for (i = 0; i < arguments.length; i++) { + messageArray.push(arguments[i]); + } - if (this._socket) { - this._socket.emit('log', messageArray); - } + if (this._socket) { + 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 { - global.Cobalt.Logger.Socket = Cobalt.Logger.Socket; } -}(typeof window !== 'undefined' ? window : (typeof exports !== 'undefined' ? exports : self))); +});