"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogManager = void 0;
const events_1 = require("events");
const LogTypes_1 = require("../common/LogTypes");
class LogManager extends events_1.EventEmitter {
    constructor() {
        super();
        this.events = [];
        this.idGenerator = 1;
    }
    log(msg, level, source) {
        if (level === LogTypes_1.LogLevel.Debug)
            return;
        const event = {
            id: this.idGenerator++,
            date: new Date(),
            level,
            msg,
            src: source
        };
        if (this.events.length > 200) {
            this.events.pop();
        }
        this.events.push(event);
        this.emit(LogManager.Events.Log, event);
    }
    getAll() {
        return this.events;
    }
}
exports.LogManager = LogManager;
LogManager.Events = {
    Log: 'log'
};
//# sourceMappingURL=LogManager.js.map