@temporalio/worker
Version:
Temporal.io SDK Worker sub-package
36 lines (35 loc) • 1.21 kB
TypeScript
import { Heap } from 'heap-js';
import { native } from '@temporalio/core-bridge';
import { LogEntry, Logger } from './logger';
/**
* A log collector that accepts log entries either through the TS `Logger` interface (e.g. used by
* the Worker, and backing Workflows and Activities Context logging) or by pushing from the native
* layer. Logs are buffered for a short period of time, then sorted and emitted to a downstream
* logger, in the right order.
*
* @internal
* @hidden
*/
export declare class NativeLogCollector {
/**
* The Logger instance ti be used to send logs to this collector
*/
readonly logger: Logger;
/**
* The downstream logger to which this collector reemits logs.
*/
protected readonly downstream: Logger;
protected buffer: Heap<LogEntry>;
constructor(downstream: Logger);
/**
* Accept logs pushed from the native layer.
*
* Called from the native layer; this function is not allowed to throw.
*/
receive(entries: native.JsonString<native.LogEntry>[]): void;
private convertFromNativeLogEntry;
/**
* Flush all buffered logs into the logger supplied to the constructor/
*/
flush(): void;
}