"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RootLogger = void 0;
const logger_1 = require("./logger");
class RootLogger extends logger_1.Logger {
    scopeBag;
    constructor(native, scopeBag, errorSerializer, purger) {
        super(native.child({
            scope: 'ROOT'
        }), errorSerializer);
        this.scopeBag = scopeBag;
        if (purger) {
            purger.start(this);
        }
    }
    wrap(method, onError = () => { }) {
        super.wrap(method, onError);
    }
    getLogger(scope) {
        const subLogger = this.native.child({
            scope: scope
        });
        this.scopeBag.scopes.push(scope);
        this.scopeBag.scopes.forEach((scope) => {
            if (scope.length > this.scopeBag.maxLength) {
                this.scopeBag.maxLength = scope.length;
            }
        });
        return new logger_1.Logger(subLogger, this.errorSerializer);
    }
}
exports.RootLogger = RootLogger;
