// Load up dependencies
if (typeof require === 'function') {
var Ne = require('neon');
+ var ioClient = require('socket.io-client');
Module = Ne.Module;
Class = Ne.Class;
} else {
prototype : {
serverUrl : '/',
- init : function () {
- this._socket = io.connect(this.serverUrl);
+ init : function (config) {
+ var logger = this;
+
+ if (config) {
+ for (property in config) {
+ logger[property] = config[property];
+ }
+ }
+
+ if (!logger.socketIo) {
+ logger.socketIo = ioClient;
+ }
+
+ 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]);
+ }
+
+ 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 {