]>
Commit | Line | Data |
---|---|---|
1 | if (typeof require === 'function') { | |
2 | require('colors'); | |
3 | } | |
4 | ||
5 | Module(Cobalt.Formatter, 'Ansi')({ | |
6 | format : function (logObject, opts){ | |
7 | var indent, | |
8 | message; | |
9 | ||
10 | indent = Array(logObject._indentLevel + 1).join(' '); | |
11 | ||
12 | message = indent + logObject.message; | |
13 | ||
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; | |
27 | } | |
28 | } | |
29 | }); |