UNPKG

serilogger

Version:

A structured logging framework for JavaScript, inspired by Serilog.

53 lines (52 loc) 1.52 kB
import { DynamicLevelSwitch } from './dynamicLevelSwitch'; import { LogEvent } from './logEvent'; import { Sink } from './sink'; export interface ApiSinkOptions { /** * If true, events be serialized using Serilog's compact format */ compact?: boolean; /** * If true, events will be buffered in local storage if available */ durable?: boolean; /** * DynamicLevelSwitch which the Seq log level will control and use */ levelSwitch?: DynamicLevelSwitch; /** * If true, errors in the pipeline will be suppressed and logged to the console instead (defaults to true) */ suppressErrors?: boolean; /** * URL of the API */ url: string; /** * Custom headers to be sent with the request */ headers?: { [key: string]: string; }; } export declare class ApiSink implements Sink { url: string; headers: { [key: string]: string; }; durable: boolean; compact: boolean; levelSwitch: DynamicLevelSwitch; refreshLevelSwitchTimeoutId: any; refreshLevelSwitchTimeoutInterval: number; suppressErrors: boolean; constructor(options: ApiSinkOptions); toString(): string; emit(events: LogEvent[]): Promise<void>; flush(): Promise<void>; private sendToServer; private updateLogLevel; private logSuppressedError; private mapLogLevel; protected postToLogger(url: any, body: any): Promise<Response>; }