"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.graylogOptions = exports.fileOptions = exports.consoleOptions = void 0;
const utils_1 = require("@cobalt-engine/utils");
const os_1 = require("os");
const path_1 = require("path");
const package_json_1 = require("../../../package.json");
const Config_1 = require("../Config");
const transportFormats_1 = require("./transportFormats");
exports.consoleOptions = {
    format: transportFormats_1.consoleFormat,
    handleExceptions: true,
};
exports.fileOptions = {
    dirname: (0, path_1.resolve)(process.cwd(), '.ewizard'),
    filename: 'debug.log',
    level: 'error',
    handleExceptions: true,
    format: transportFormats_1.fileFormat,
};
const ewizardConfig = Config_1.Config.getSync();
exports.graylogOptions = (0, utils_1.deepMixin)(ewizardConfig.graylog, {
    staticMeta: getStaticOptions(),
});
function getStaticOptions() {
    return {
        NODE_VERSION: process.version,
        service_version: package_json_1.version,
        command: getCommand(),
        user: getUser(ewizardConfig),
        ewizard_url: getEwizardUrl(ewizardConfig),
        platform: (0, os_1.type)(),
        os_version: (0, os_1.release)(),
    };
}
function getCommand() {
    const name = (0, path_1.basename)(process.argv[1], '.js');
    const args = process.argv.slice(2).join(' ');
    return `${name} ${args}`;
}
function getUser({ ewizard = {} }) {
    return ewizard.email || 'unauthorized';
}
function getEwizardUrl({ ewizard = {} }) {
    return ewizard.url || 'unavailable';
}
//# sourceMappingURL=transportOptions.js.map