UNPKG

@embrace-io/web-sdk

Version:
29 lines (28 loc) 1.06 kB
import { KEY_APP_SURFACE_LABEL, KEY_EMB_PAGE_ID, KEY_EMB_PAGE_PATH } from "../../constants/attributes.js"; //#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(KEY_EMB_PAGE_PATH, currentRoute.path); logRecord.setAttribute(KEY_EMB_PAGE_ID, this._pageManager.getCurrentPageId()); } } const appSurfaceLabel = this._pageManager.getPageLabel(); if (appSurfaceLabel && !logRecord.attributes["app.surface.label"]) logRecord.setAttribute(KEY_APP_SURFACE_LABEL, appSurfaceLabel); } shutdown() { return Promise.resolve(void 0); } }; //#endregion export { PageLogRecordProcessor }; //# sourceMappingURL=PageLogRecordProcessor.js.map