"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Formatter_1 = require("../logging/Formatter");
const LogLevel_1 = require("../logging/LogLevel");
class ConsoleLogger {
    constructor({ formatter = Formatter_1.defaultFormatter() } = {}) {
        this.fmt = formatter.format;
        this.fmtOptional = formatter.optional;
    }
    debug(timestamp, loggerName, message, obj) {
        if (obj) {
            console.debug(this.fmt(LogLevel_1.LogLevel.DEBUG, timestamp, loggerName, message), this.fmtOptional(obj));
        }
        else {
            console.debug(this.fmt(LogLevel_1.LogLevel.DEBUG, timestamp, loggerName, message));
        }
    }
    info(timestamp, loggerName, message, obj) {
        if (obj) {
            console.info(this.fmt(LogLevel_1.LogLevel.INFO, timestamp, loggerName, message), this.fmtOptional(obj));
        }
        else {
            console.info(this.fmt(LogLevel_1.LogLevel.INFO, timestamp, loggerName, message));
        }
    }
    warn(timestamp, loggerName, message, obj) {
        if (obj) {
            console.warn(this.fmt(LogLevel_1.LogLevel.WARN, timestamp, loggerName, message), this.fmtOptional(obj));
        }
        else {
            console.warn(this.fmt(LogLevel_1.LogLevel.WARN, timestamp, loggerName, message));
        }
    }
    error(timestamp, loggerName, message, obj) {
        if (obj) {
            console.error(this.fmt(LogLevel_1.LogLevel.ERROR, timestamp, loggerName, message), this.fmtOptional(obj));
        }
        else {
            console.error(this.fmt(LogLevel_1.LogLevel.ERROR, timestamp, loggerName, message));
        }
    }
    fatal(timestamp, loggerName, message, obj) {
        if (obj) {
            console.error(this.fmt(LogLevel_1.LogLevel.FATAL, timestamp, loggerName, message), this.fmtOptional(obj));
        }
        else {
            console.error(this.fmt(LogLevel_1.LogLevel.FATAL, timestamp, loggerName, message));
        }
    }
}
exports.ConsoleLogger = ConsoleLogger;
//# sourceMappingURL=ConsoleLogger.js.map