UNPKG

winston-transport-debug-console

Version:

A Winston transport that makes logs visible in inspector clients (like VS Code’s Debug Console) with support for fully inspectable objects.

28 lines (27 loc) 953 B
import Transport, { TransportStreamOptions } from "winston-transport" import type { LogEntry } from "winston" import inspector from "node:inspector" export interface DebugConsoleOptions extends TransportStreamOptions { /** * Map unsupported Winston levels to existing inspector console methods. * @throws if you try to use a level that isn’t supported and isn’t mapped. */ levelMap?: | LevelMap | { [level: string]: InspectorConsoleMethods } /** * Whether to log the `info` object as the last argument to the console method. */ logInfo?: boolean } export declare class DebugConsole extends Transport { private levelMap private logInfo constructor(options?: DebugConsoleOptions) log(info: LogEntry, next: () => unknown): void } type InspectorConsoleMethods = keyof typeof inspector.console type LevelMap = Map<string, InspectorConsoleMethods> export {}