gulp-io
Version:
iio's front-end build tools.
41 lines (35 loc) • 1.02 kB
JavaScript
var clc = require('cli-color');
var Log = module.exports = (function () {
function Log(theme, type) {
if (theme === void 0) { theme = "White"; }
if (type === void 0) { type = "text"; }
this.theme = undefined;
this.type = undefined;
this.themes = {
purple: clc.xterm(20).bold,
red: clc.xterm(124).bold,
green: clc.xterm(70).bold,
orange: clc.xterm(214).bold,
gray: clc.xterm(249).bold,
blue: clc.xterm(38).bold,
white: clc.xterm(255).bold
};
this.theme = theme;
this.type = type;
}
Log.prototype.log = function (who, what) {
var logging = true;
var debuging = true;
if (who === void 0) { who = "Unknown"; }
if (logging && (debuging || this.type === "error" || this.type === "success")) {
console.log(this.themes["gray"]("[iio] ≋ ") + this.themes[this.theme.toLowerCase()](who + ": " + what));
}
if (this.type === 'error') {
if (!logging) {
throw message;
}
process.exit(code = 0);
}
};
return Log;
})();