UNPKG

@embrace-io/web-sdk

Version:
30 lines (29 loc) 1.22 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const require_constants_attributes = require("../../constants/attributes.cjs"); //#region src/processors/PageLogRecordProcessor/PageLogRecordProcessor.ts var PageLogRecordProcessor = class { _pageManager; constructor({ pageManager }) { this._pageManager = pageManager; } forceFlush() { return Promise.resolve(void 0); } onEmit(logRecord) { if (!logRecord.attributes["app.surface.name"] || !logRecord.attributes["app.surface.id"]) { const currentRoute = this._pageManager.getCurrentRoute(); if (currentRoute) { logRecord.setAttribute(require_constants_attributes.KEY_EMB_PAGE_PATH, currentRoute.path); logRecord.setAttribute(require_constants_attributes.KEY_EMB_PAGE_ID, this._pageManager.getCurrentPageId()); } } const appSurfaceLabel = this._pageManager.getPageLabel(); if (appSurfaceLabel && !logRecord.attributes["app.surface.label"]) logRecord.setAttribute(require_constants_attributes.KEY_APP_SURFACE_LABEL, appSurfaceLabel); } shutdown() { return Promise.resolve(void 0); } }; //#endregion exports.PageLogRecordProcessor = PageLogRecordProcessor; //# sourceMappingURL=PageLogRecordProcessor.cjs.map