UNPKG

@awarns/tracing

Version:

AwarNS Framework package that eases the tracing and debugging of complex task execution workflows

17 lines 784 B
import { Task } from '@awarns/core/tasks'; import { syncedTracesStore } from '../stores'; import { Trace, TraceResult, TraceType } from '../entities'; export class EventTrackerTask extends Task { constructor(name, tracerConfig, tracesStore = syncedTracesStore) { super(name); this.tracesStore = tracesStore; this.sensitiveData = tracerConfig && tracerConfig.outputsSensitiveData; } async onRun(taskParams, invocationEvent) { const { id, name, data } = invocationEvent; const trace = new Trace(id, TraceType.EVENT, name, TraceResult.OK, this.sensitiveData ? {} : data); await this.tracesStore.insert(trace); this.log(`Event trace recorded: ${JSON.stringify(trace)}`); } } //# sourceMappingURL=event-tracker.js.map