]>
git.r.bdr.sh - rbdr/cologne/blob - lib/loggers/socket.js
b057d77726e8b4b25ae238392f4f3c83d5de354b
4 // Load up dependencies
5 if (typeof require
=== 'function') {
6 var Ne
= require('neon');
7 var ioClient
= require('socket.io-client');
11 Module
= global
.Module
;
16 Module(Cobalt
, 'Logger')({});
18 Cobalt
.Logger
.Socket
= Class(Cobalt
.Logger
, 'Socket')({
22 init : function (config
) {
26 for (property
in config
) {
27 logger
[property
] = config
[property
];
31 if (!logger
.socketIo
) {
32 logger
.socketIo
= ioClient
;
35 logger
._socket
= logger
.socketIo
.connect(logger
.serverUrl
);
39 var i
, messageArray
= [];
41 for (i
= 0; i
< arguments
.length
; i
++) {
42 messageArray
.push(arguments
[i
]);
46 this._socket
.emit('log', messageArray
);
52 if (Cobalt
.Logger
.Socket
.__objectSpy
) {
53 Cobalt
.Logger
.Socket
.__objectSpy
.destroy();
56 if (typeof require
=== 'function') {
57 global
.Socket
= Cobalt
.Logger
.Socket
;
59 global
.Cobalt
.Logger
.Socket
= Cobalt
.Logger
.Socket
;
61 }(typeof window
!== 'undefined' ? window : (typeof exports
!== 'undefined' ? exports : self
)));