]>
git.r.bdr.sh - rbdr/cologne/blob - lib/loggers/console.js
c4031eb2e8c86ebed909bd4d3bf4df2cf1aa9c05
1 Class(Cobalt
.Logger
, 'JsConsole')({
6 init : function (config
) {
11 for (property
in config
) {
12 logger
[property
] = config
[property
];
16 if (!logger
.console
) {
17 logger
.console
= console
;
22 var i
, message
= [], severity
;
24 for (i
= 0; i
< arguments
.length
; i
++) {
25 // We're not formatting objects for now.
27 if (!arguments
[i
].__skipConsole
&& !arguments
[i
].message
.__skipConsole
) {
28 if (typeof arguments
[i
].message
=== 'object') {
29 message
.push(arguments
[i
].message
);
31 message
.push(this.format(arguments
[i
]));
34 severity
= arguments
[i
]._level
44 this.console
.error
.apply(this.console
, message
);
47 this.console
.warn
.apply(this.console
, message
);
51 this.console
.info
.apply(this.console
, message
);
55 this.console
.log
.apply(this.console
, message
);
60 format : function (logObject
) {
61 // Usually what you want to do here is format. Preferably using
62 // someone inside Cobalt.Formatter
64 return this.formatter
.format(logObject
, this.formatterOpts
);
67 return logObject
.message
;