]> git.r.bdr.sh - rbdr/cologne/blame - lib/formatters/ansi.js
Makes file logger append by default
[rbdr/cologne] / lib / formatters / ansi.js
CommitLineData
db6bc3cb 1if (typeof require === 'function') {
bdedb5e5 2 require('colors');
db6bc3cb 3}
bdedb5e5 4
db6bc3cb
BB
5Module(Cobalt.Formatter, 'Ansi')({
6 format : function (logObject, opts){
7 var indent,
8 message;
bdedb5e5 9
db6bc3cb 10 indent = Array(logObject._indentLevel + 1).join(' ');
bdedb5e5 11
db6bc3cb 12 message = indent + logObject.message;
bdedb5e5 13
db6bc3cb
BB
14 switch(logObject._level) {
15 case 0:
16 case 1:
17 case 2:
18 case 3:
19 return message.red;
20 case 4:
21 return message.yellow;
22 case 5:
23 case 6:
24 return message.blue;
25 default:
26 return message;
bdedb5e5 27 }
bdedb5e5 28 }
db6bc3cb 29});