]>
Commit | Line | Data |
---|---|---|
bdedb5e5 BB |
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 | ||
71a808fe BB |
25 | log : function () { |
26 | var i, messageArray = []; | |
27 | ||
28 | for (i = 0; i < arguments.length; i++) { | |
29 | messageArray.push(arguments[i]); | |
30 | } | |
31 | ||
32 | this._socket.emit('log', messageArray); | |
bdedb5e5 BB |
33 | } |
34 | } | |
35 | }); | |
36 | ||
71a808fe BB |
37 | if (Cobalt.Logger.Socket.__objectSpy) { |
38 | Cobalt.Logger.Socket.__objectSpy.destroy(); | |
39 | } | |
40 | ||
bdedb5e5 BB |
41 | if (typeof require === 'function') { |
42 | global.Socket = Cobalt.Logger.Socket; | |
43 | } else { | |
44 | global.Cobalt.Logger.Socket = Cobalt.Logger.Socket; | |
45 | } | |
46 | }(typeof window !== 'undefined' ? window : (typeof exports !== 'undefined' ? exports : self))); |