"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const forEach_1 = tslib_1.__importDefault(require("lodash/forEach"));
const ansi_colors_1 = tslib_1.__importDefault(require("ansi-colors"));
exports.chalk = ansi_colors_1.default;
let level = 4;
const levels = {
    error: 0,
    warn: 1,
    info: 2,
    debug: 3,
    success: -Infinity,
    question: -Infinity,
};
const methodColors = {
    error: 'red',
    warn: 'yellow',
    info: 'grey',
    success: 'green',
    question: 'cyan',
    debug: 'magenta'
};
exports.logger = {};
exports.colors = {};
exports.setLevel = value => {
    level = value;
};
forEach_1.default(methodColors, (color, loggerMethod) => {
    exports.logger[loggerMethod] = (str) => {
        if (level >= levels[loggerMethod]) {
            console.error(ansi_colors_1.default[color](str));
        }
    };
    exports.logger[loggerMethod + 'Bold'] = (str) => exports.logger[loggerMethod](ansi_colors_1.default.bold(str));
    exports.colors[loggerMethod] = (...args) => ansi_colors_1.default[color](...args);
});
exports.printColors = () => {
    Object.getOwnPropertyNames(ansi_colors_1.default)
        .filter(key => typeof ansi_colors_1.default[key] === 'function')
        .map(color => {
        try {
            return ansi_colors_1.default[color](color);
        }
        catch (err) { }
    })
        .filter(val => typeof val === 'string')
        .forEach(str => console.log(str));
};
//# sourceMappingURL=logger.js.map