"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupLogging = setupLogging;
const genesys_cloud_client_logger_1 = __importDefault(require("genesys-cloud-client-logger"));
function setupLogging(logger) {
    const { logLevel, optOutOfTelemetry, originAppId, originAppName, originAppVersion, logFormatters, customHeaders } = this._config;
    let url = `https://api.${this._config.environment}/api/v2/diagnostics/trace`;
    let accessToken = this._config.accessToken;
    if (this.isJwtAuth) {
        url += '/backgroundassistant';
        accessToken = this._config.jwt;
    }
    this.logger = new genesys_cloud_client_logger_1.default({
        accessToken,
        logLevel,
        url,
        appVersion: this.VERSION,
        appName: 'webrtc-sdk',
        uploadDebounceTime: 1000,
        initializeServerLogging: !(this.isGuest || optOutOfTelemetry),
        logger,
        formatters: logFormatters,
        /* consumerApp info */
        originAppId,
        originAppName,
        originAppVersion,
        customHeaders
    });
    if (this.isGuest) {
        this.logger.debug('Guest user. Not logging to server', null, { skipServer: true });
        return;
    }
    this.logger.debug('Authenticated user. Initializing server logging', null, { skipServer: true });
}
//# sourceMappingURL=logging.js.map