UNPKG

@embrace-io/web-sdk

Version:
32 lines (31 loc) 1.12 kB
import { createSafeProxy } from "../../../utils/createSafeProxy/createSafeProxy.js"; import { NoOpLogManager } from "../../manager/NoOpLogManager/NoOpLogManager.js"; import { ProxyLogManager } from "../../manager/ProxyLogManager/ProxyLogManager.js"; import { diag } from "@opentelemetry/api"; //#region src/api-logs/api/LogAPI/LogAPI.ts const NOOP_LOG_MANAGER = new NoOpLogManager(); const INTERNAL_METHODS = /* @__PURE__ */ new Set(["setDelegate", "getDelegate"]); var LogAPI = class LogAPI { static _instance; static getInstance() { if (!LogAPI._instance) { const proxyManager = new ProxyLogManager(); const safeManager = createSafeProxy(proxyManager, NOOP_LOG_MANAGER, diag.createComponentLogger({ namespace: "LogAPI" }), INTERNAL_METHODS); LogAPI._instance = Object.assign(safeManager, { setGlobalLogManager(logManager) { proxyManager.setDelegate(logManager); }, getLogManager() { return proxyManager; } }); } return LogAPI._instance; } static resetInstance() { LogAPI._instance = void 0; } }; //#endregion export { LogAPI }; //# sourceMappingURL=LogAPI.js.map