"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const common_1 = require("@nestjs/common");
const bash_color_1 = require("bash-color");
class Logger extends common_1.ConsoleLogger {
    constructor() {
        super(...arguments);
        this.pluginName = ('Homebridge UI');
        this.useTimestamps = (process.env.UIX_LOG_NO_TIMESTAMPS !== '1');
    }
    get prefix() {
        if (this.useTimestamps) {
            return (0, bash_color_1.white)(`[${new Date().toLocaleString()}] `) + (0, bash_color_1.cyan)(`[${this.pluginName}]`);
        }
        else {
            return (0, bash_color_1.cyan)(`[${this.pluginName}]`);
        }
    }
    log(...args) {
        console.log(this.prefix, ...args);
    }
    success(...args) {
        console.log(this.prefix, ...args.map(x => (0, bash_color_1.green)(x)));
    }
    error(...args) {
        console.error(this.prefix, ...args.map(x => (0, bash_color_1.red)(x)));
    }
    warn(...args) {
        console.warn(this.prefix, ...args.map(x => (0, bash_color_1.yellow)(x)));
    }
    debug(...args) {
        if (process.env.UIX_DEBUG_LOGGING === '1') {
            console.debug(this.prefix, ...args.map(x => (0, bash_color_1.green)(x)));
        }
    }
    verbose(...args) {
        console.debug(this.prefix, ...args);
    }
}
exports.Logger = Logger;
//# sourceMappingURL=logger.service.js.map