]>
git.r.bdr.sh - rbdr/cologne/blob - lib/loggers/console.js
e8f4d86f4cac8c45c7709b87dba3b81aef50eed8
4 // Load up dependencies
5 if (typeof require
=== 'function') {
6 var Ne
= require('neon');
10 Module
= global
.Module
;
15 Module(Cobalt
, 'Logger')({});
17 Cobalt
.Logger
.JsConsole
= Class(Cobalt
.Logger
, 'JsConsole')({
22 init : function (config
) {
27 for (property
in config
) {
28 logger
[property
] = config
[property
];
32 if (!logger
.console
) {
33 logger
.console
= console
;
38 var i
, message
= [], severity
;
40 for (i
= 0; i
< arguments
.length
; i
++) {
41 // We're not formatting objects for now.
43 if (typeof arguments
[i
].message
=== 'object') {
44 message
.push(arguments
[i
].message
);
46 message
.push(this.format(arguments
[i
]));
49 severity
= arguments
[i
]._level
58 this.console
.error
.apply(this.console
, message
);
61 this.console
.warn
.apply(this.console
, message
);
65 this.console
.info
.apply(this.console
, message
);
69 this.console
.log
.apply(this.console
, message
);
74 format : function (logObject
) {
75 // Usually what you want to do here is format. Preferably using
76 // someone inside Cobalt.Formatter
78 return this.formatter
.format(logObject
, this.formatterOpts
);
81 return logObject
.message
;
86 if (Cobalt
.Logger
.JsConsole
.__objectSpy
) {
87 Cobalt
.Logger
.JsConsole
.__objectSpy
.destroy();
90 if (typeof require
=== 'function') {
91 global
.JsConsole
= Cobalt
.Logger
.JsConsole
;
93 global
.Cobalt
.Logger
.JsConsole
= Cobalt
.Logger
.JsConsole
;
95 }(typeof window
!== 'undefined' ? window : (typeof exports
!== 'undefined' ? exports : self
)));