]> git.r.bdr.sh - rbdr/cologne/blob - lib/loggers/socket.js
8d0ff55dd859b6e48eaa1024799d537e8ab5ce81
[rbdr/cologne] / lib / loggers / socket.js
1 (function (global) {
2 var Module, Class;
3
4 // Load up dependencies
5 if (typeof require === 'function') {
6 var Ne = require('neon');
7 Module = Ne.Module;
8 Class = Ne.Class;
9 } else {
10 Module = global.Module;
11 Class = global.Class;
12 }
13
14 var Cobalt = {};
15 Module(Cobalt, 'Logger')({});
16
17 Cobalt.Logger.Socket = Class(Cobalt.Logger, 'Socket')({
18 prototype : {
19 serverUrl : '/',
20
21 init : function () {
22 this._socket = io.connect(this.serverUrl);
23 },
24
25 log : function (logObject) {
26 this._socket.emit('log', logObject);
27 }
28 }
29 });
30
31 if (typeof require === 'function') {
32 global.Socket = Cobalt.Logger.Socket;
33 } else {
34 global.Cobalt.Logger.Socket = Cobalt.Logger.Socket;
35 }
36 }(typeof window !== 'undefined' ? window : (typeof exports !== 'undefined' ? exports : self)));