"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockLogger = void 0;
class MockLogger {
    constructor() {
        this.taggedLogMessages = MockLogger.emptyTaggedLogMessages();
    }
    static emptyTaggedLogMessages() {
        return {
            tags: {},
            logs: {}
        };
    }
    reset() {
        this.taggedLogMessages = MockLogger.emptyTaggedLogMessages();
    }
    getMessages(level, ...tags) {
        let taggedLogMessages = this.taggedLogMessages;
        for (const tag of tags) {
            if (!taggedLogMessages.tags[tag]) {
                return [];
            }
            taggedLogMessages = taggedLogMessages.tags[tag];
        }
        return taggedLogMessages.logs[level] || [];
    }
    init() { }
    doLog(taggedLogMessages, level, tags, args) {
        if (tags.length > 0) {
            const tag = tags[0];
            const remainingTags = tags.slice(1);
            const subTaggedLogsMessages = taggedLogMessages.tags[tag] || MockLogger.emptyTaggedLogMessages();
            this.doLog(subTaggedLogsMessages, level, remainingTags, args);
            taggedLogMessages.tags[tag] = subTaggedLogsMessages;
        }
        else {
            const logMessages = taggedLogMessages.logs[level] || [];
            logMessages.push(args);
            taggedLogMessages.logs[level] = logMessages;
        }
    }
    log(level, tags, args) {
        this.doLog(this.taggedLogMessages, level, tags, args);
    }
    tag(...tags) {
        return {
            debug: (...args) => this.log('debug', tags, args),
            info: (...args) => this.log('info', tags, args),
            warn: (...args) => this.log('warn', tags, args),
            error: (...args) => this.log('error', tags, args),
            profile: (...args) => this.log('profile', tags, args),
        };
    }
}
exports.MockLogger = MockLogger;
exports.default = new MockLogger();
//# sourceMappingURL=logger.js.map