UNPKG

fixparser-plugin-log-console

Version:

Console / JSON Log transport for FIXParser

47 lines (46 loc) 1.41 kB
import type { ILogTransporter, LogMessage } from 'fixparser-common'; /** * Logger output format options. * * - 'console': Output log in plain text format * - 'json': Output log in JSON format * - 'jsonrpc': Output log in JSON-RPC 2.0 format * * @public */ export type ConsoleFormat = 'console' | 'json' | 'jsonrpc'; /** * A LogTransporter implementation for logging to the console. * It supports text (console), JSON, and JSON-RPC 2.0 formats. */ export declare class ConsoleLogTransport implements ILogTransporter { private format; private useStderr; constructor({ format, useStderr }: { format: ConsoleFormat; useStderr?: boolean; }); /** * Configures the format for console logging (either 'console' for text, 'json', or 'jsonrpc'). */ configure(config: { format: 'console' | 'json' | 'jsonrpc'; useStderr?: boolean; }): void; /** * Sends the log message to the console in the configured format. */ send(log: LogMessage): Promise<void>; /** * Flushes the log buffer (if any buffering mechanism exists). */ flush(): Promise<void>; /** * Closes the transport (not needed for console, but keeping the method for consistency). */ close(): Promise<void>; /** * Returns the status of the transport (always "connected" for console). */ status(): string; }