]>
git.r.bdr.sh - rbdr/cologne/blob - lib/loggers/console.js
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
, messageArray
= [], message
, severity
;
40 for (i
= 0; i
< arguments
.length
; i
++) {
41 messageArray
.push(this.format(arguments
[i
]));
43 severity
= arguments
[i
]._level
47 message
= messageArray
.join(' ');
54 this.console
.error(message
);
57 this.console
.warn(message
);
61 this.console
.info(message
);
65 this.console
.log(message
);
70 format : function (logObject
) {
71 // Usually what you want to do here is format. Preferably using
72 // someone inside Cobalt.Formatter
74 return this.formatter
.format(logObject
, this.formatterOpts
);
82 if (Cobalt
.Logger
.JsConsole
.__objectSpy
) {
83 Cobalt
.Logger
.JsConsole
.__objectSpy
.destroy();
86 if (typeof require
=== 'function') {
87 global
.JsConsole
= Cobalt
.Logger
.JsConsole
;
89 global
.Cobalt
.Logger
.JsConsole
= Cobalt
.Logger
.JsConsole
;
91 }(typeof window
!== 'undefined' ? window : (typeof exports
!== 'undefined' ? exports : self
)));