UNPKG

serilogger

Version:

A structured logging framework for JavaScript, inspired by Serilog.

38 lines (37 loc) 1.19 kB
import { LogEvent } from "./logEvent"; import { Sink } from "./sink"; export interface BatchedSinkOptions { /** * Maximum number of events to be sent in a single batch. */ maxSize?: number; /** * Number of seconds to wait between checking for batches. */ period?: number; /** * {Storage} instance to be used for durable storage of log events. */ durableStore?: Storage; } export declare const defaultBatchedSinkOptions: BatchedSinkOptions; export declare class BatchedSink implements Sink { protected durableStorageKey: string; protected options: BatchedSinkOptions; protected innerSink?: Sink; protected batchedEvents: LogEvent[]; private batchTimeout; private batchKey; private shouldCycleContinue; constructor(innerSink?: Sink, options?: BatchedSinkOptions); emit(events: LogEvent[]): LogEvent[]; flush(): Promise<any>; /** * The will stop the cycle. Used for testing. */ stopCycle(): void; protected emitCore(events: LogEvent[]): any; protected flushCore(): Promise<any>; protected cycleBatch(): void; private storeEvents; }