beforeEach(function () { var stub = _.reduce(LEVELS.NAMES, function (console, level) { console[level] = sinon.stub() return console }, {}) _.assign(stub, { groupCollapsed: sinon.stub(), groupEnd: sinon.stub(), log: sinon.stub() }) stubConsole(stub) })
function formatMessage () { var formattedName = _.reduce(name.split(':'), function (memo, value, index) { if (index !== 0) { return memo + chalk.gray(':') + chalk.magenta(value) } return memo + chalk.magenta(value) }, '') var parts = [ chalk.bold[levelColors[level]](rightPad(level.toUpperCase(), 5)), chalk.gray('[') + formattedName + chalk.gray(']'), chalk.white(components.message) ] if (LOG_TIMESTAMP) { parts.unshift(now.toJSON()) } return parts.join(' ') }