import { Logger } from 'tslog';
import { Service } from '../core/Service.js';
export var LogLevel;
(function (LogLevel) {
    LogLevel[LogLevel["Silly"] = 0] = "Silly";
    LogLevel[LogLevel["Trace"] = 1] = "Trace";
    LogLevel[LogLevel["Debug"] = 2] = "Debug";
    LogLevel[LogLevel["Info"] = 3] = "Info";
    LogLevel[LogLevel["Warn"] = 4] = "Warn";
    LogLevel[LogLevel["Error"] = 5] = "Error";
    LogLevel[LogLevel["Fatal"] = 6] = "Fatal";
})(LogLevel || (LogLevel = {}));
export default class LoggingService extends Service {
    static key = 'api-service/logger';
    logger;
    /**
     * 0: silly, 1: trace, 2: debug, 3: info, 4: warn, 5: error, 6: fatal
     */
    level = LogLevel.Error;
    constructor(env = 'production') {
        super();
        this.level = env === 'production' ? LogLevel.Trace : LogLevel.Error;
    }
    async onCreate() {
        this.logger = new Logger({ name: 'quick-api', type: 'pretty', minLevel: this.level });
    }
    silly(...args) {
        this.logger.silly(...args);
    }
    debug(...args) {
        this.logger.debug(...args);
    }
    info(...args) {
        this.logger.info(...args);
    }
    warn(...args) {
        this.logger.warn(...args);
    }
    error(...args) {
        this.logger.error(...args);
    }
    fatal(...args) {
        this.logger.fatal(...args);
    }
    trace(...args) {
        this.logger.trace(...args);
    }
}
//# sourceMappingURL=LoggingService.js.map