aboutsummaryrefslogtreecommitdiff
path: root/lib/formatters/simple.js
blob: 24f65b37378bbfe1223e24892784342a04227280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(function (global) {
  var Module;

  // Load up dependencies
  if (typeof require === 'function') {
    var Ne = require('neon');
    Module = Ne.Module;
  } else {
    Module = global.Module;
  }

  var Cobalt = {};
  Module(Cobalt, 'Formatter')({});

  Cobalt.Formatter.Simple = Module(Cobalt.Formatter, 'Simple')({
    format : function (logObject, opts){
      var indent;

      indent = Array(logObject._indentLevel + 1).join(' ');

      return indent + logObject.message;
    }
  });

  if (typeof require === 'function') {
    global.Simple = Cobalt.Formatter.Simple;
  } else {
    global.Cobalt.Formatter.Simple = Cobalt.Formatter.Simple;
  }
}(typeof window !== 'undefined' ? window : (typeof exports !== 'undefined' ? exports : self)));