"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var logLevel_1 = require("./logLevel");
exports.createLoggerInstance = function (parent, parentTags, tags) {
    var tagString = parentTags + tags.map(function (tag) { return "[" + tag + "]"; }).join();
    var createSubLogger = function () {
        var extraTags = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            extraTags[_i] = arguments[_i];
        }
        return exports.createLoggerInstance(parent, tagString, extraTags);
    };
    var createLevelLogger = function (level) { return function () {
        var messages = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            messages[_i] = arguments[_i];
        }
        return parent.log.apply(parent, tslib_1.__spread([level, tagString], messages));
    }; };
    var log = function (level) {
        var messages = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            messages[_i - 1] = arguments[_i];
        }
        return parent.log.apply(parent, tslib_1.__spread([level, tagString], messages));
    };
    return {
        createSubLogger: createSubLogger,
        log: log,
        debug: createLevelLogger(logLevel_1.ELogLevel.Debug),
        info: createLevelLogger(logLevel_1.ELogLevel.Info),
        warn: createLevelLogger(logLevel_1.ELogLevel.Warning),
        error: createLevelLogger(logLevel_1.ELogLevel.Error),
        fatal: createLevelLogger(logLevel_1.ELogLevel.Fatal),
    };
};
