UNPKG

prism-logger

Version:

beautified logging in nodejs

81 lines (80 loc) 2.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PrismLogger = void 0; var options_interface_1 = require("../interface/options.interface"); var PrismLogger = /** @class */ (function () { function PrismLogger() { PrismLogger.log("Logger instance created"); } PrismLogger.log = function (text, color) { if (color === void 0) { color = "white"; } console.log(options_interface_1.option.reset, options_interface_1.option.bright, options_interface_1.option.fg[color] + "\r", text, options_interface_1.option.reset); }; PrismLogger.error = function (text) { PrismLogger.log(text, "red"); }; PrismLogger.success = function (text) { PrismLogger.log(text, "green"); }; PrismLogger.warning = function (text) { PrismLogger.log(text, "yellow"); }; PrismLogger.red = function (text) { PrismLogger.log(text, "red"); }; PrismLogger.green = function (text) { PrismLogger.log(text, "green"); }; PrismLogger.yellow = function (text) { PrismLogger.log(text, "yellow"); }; PrismLogger.blue = function (text) { PrismLogger.log(text, "blue"); }; PrismLogger.magenta = function (text) { PrismLogger.log(text, "magenta"); }; PrismLogger.cyan = function (text) { PrismLogger.log(text, "cyan"); }; PrismLogger.white = function (text) { PrismLogger.log(text, "white"); }; PrismLogger.logBg = function (text, font, bg) { if (font === void 0) { font = "black"; } if (bg === void 0) { bg = "white"; } console.log(options_interface_1.option.reset, options_interface_1.option.bg[bg], options_interface_1.option.bright, options_interface_1.option.fg[font] + "\r", text, options_interface_1.option.reset); }; PrismLogger.errorBg = function (text) { PrismLogger.logBg(text, "white", "red"); }; PrismLogger.successBg = function (text) { PrismLogger.logBg(text, "white", "green"); }; PrismLogger.warningBg = function (text) { PrismLogger.logBg(text, "red", "yellow"); }; PrismLogger.redBg = function (text) { PrismLogger.logBg(text, "white", "red"); }; PrismLogger.greenBg = function (text) { PrismLogger.logBg(text, "white", "green"); }; PrismLogger.yellowBg = function (text) { PrismLogger.logBg(text, "red", "yellow"); }; PrismLogger.blueBg = function (text) { PrismLogger.logBg(text, "white", "blue"); }; PrismLogger.magentaBg = function (text) { PrismLogger.logBg(text, "white", "magenta"); }; PrismLogger.cyanBg = function (text) { PrismLogger.logBg(text, "white", "cyan"); }; PrismLogger.whiteBg = function (text) { PrismLogger.logBg(text, "black", "white"); }; return PrismLogger; }()); exports.PrismLogger = PrismLogger;