ecommerce
Version:
Easily create Ecommerce sites powered by Hanzo.
52 lines (44 loc) • 1.02 kB
JavaScript
// Generated by CoffeeScript 1.11.1
var colors, fn, i, len, log, method, pretty, ref;
colors = require('colors/safe');
colors.setTheme({
silly: 'rainbow',
input: 'grey',
verbose: 'cyan',
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
warn: 'yellow',
debug: 'blue',
error: 'red'
});
pretty = function(obj) {
return JSON.stringify(obj, null, 2);
};
log = function() {
return console.log.apply(console, arguments);
};
ref = ['debug', 'info', 'warn', 'error'];
fn = function(method) {
var prefix;
prefix = colors[method](method + ' ');
return log[method] = function(msg, extra) {
if (typeof msg === 'string') {
msg = prefix + msg;
} else {
msg = prefix + '\n' + pretty(msg);
}
if (extra != null) {
return console.log(msg, '\n' + pretty(extra));
} else {
return console.log(msg);
}
};
};
for (i = 0, len = ref.length; i < len; i++) {
method = ref[i];
fn(method);
}
module.exports = log;
//# sourceMappingURL=log.js.map