UNPKG

@ogcio/o11y-sdk-node

Version:

Opentelemetry standard instrumentation SDK for NodeJS based project

20 lines (19 loc) 543 B
export class EnrichLogProcessor { _spanAttributes = undefined; constructor(spanAttributes) { this._spanAttributes = spanAttributes; } forceFlush() { return Promise.resolve(); } onEmit(logRecord, _context) { if (this._spanAttributes) { for (const [key, value] of Object.entries(this._spanAttributes)) { logRecord.setAttribute(key, typeof value === "function" ? value() : value); } } } shutdown() { return Promise.resolve(); } }