X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/blobdiff_plain/bdedb5e54032363de8afa322fadae0e2cb2132d0..54a5290bbcae03d129dd21401a4dae98d0aef775:/lib/formatters/ansi.js?ds=sidebyside diff --git a/lib/formatters/ansi.js b/lib/formatters/ansi.js index 25ad256..806869a 100644 --- a/lib/formatters/ansi.js +++ b/lib/formatters/ansi.js @@ -1,47 +1,29 @@ -(function (global) { - var Module; - - // Load up dependencies - if (typeof require === 'function') { +if (typeof require === 'function') { require('colors'); - var Ne = require('neon'); - Module = Ne.Module; - } else { - Module = global.Module; - } +} - var Cobalt = {}; - Module(Cobalt, 'Formatter')({}); +Module(Cobalt.Formatter, 'Ansi')({ + format : function (logObject, opts){ + var indent, + message; - Cobalt.Formatter.Ansi = Module(Cobalt.Formatter, 'Ansi')({ - format : function (logObject, opts){ - var indent, - message; + indent = Array(logObject._indentLevel + 1).join(' '); - indent = Array(logObject._indentLevel + 1).join(' '); + message = indent + logObject.message; - message = indent + logObject.message; - - switch(logObject._level) { - case 0: - case 1: - case 2: - case 3: - return message.red; - case 4: - return message.yellow; - case 5: - case 6: - return message.blue; - default: - return message; - } + switch(logObject._level) { + case 0: + case 1: + case 2: + case 3: + return message.red; + case 4: + return message.yellow; + case 5: + case 6: + return message.blue; + default: + return message; } - }); - - if (typeof require === 'function') { - global.Ansi = Cobalt.Formatter.Ansi; - } else { - global.Cobalt.Formatter.Ansi = Cobalt.Formatter.Ansi; } -}(typeof window !== 'undefined' ? window : (typeof exports !== 'undefined' ? exports : self))); +});