import { Logger } from 'pino'; import { Context } from '@orpc/server'; import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions } from '@orpc/server/standard'; declare const LOGGER_CONTEXT_SYMBOL: unique symbol; interface LoggerContext { [LOGGER_CONTEXT_SYMBOL]?: undefined | Logger; } declare function getLogger(context: LoggerContext): Logger | undefined; interface PinoHandlerPluginOptions { /** * Logger instance to use for logging. * * @default pino() */ logger?: Logger; /** * Function to generate a unique ID for each request. * * @default ({ request }) => flattenStandardHeader(request.headers['x-request-id']) ?? crypto.randomUUID() */ generateRequestId?: (options: StandardHandlerRoutingInterceptorOptions) => string; /** * If true, this plugin will log information about request lifecycle, * including when a request is received, handled, or no matching procedure is found. * * @default false */ logLifecycle?: boolean; /** * If true, this plugin will log when a request signal is aborted. * * @default false */ logAbort?: boolean; } declare class PinoHandlerPlugin implements StandardHandlerPlugin { name: string; /** * - Logging interceptors should run after OpenTelemetry interceptors * so they execute within the active request span. * - Logging interceptors should run after batch interceptors * so they log each individual request instead of the batch request. */ before: string[]; private readonly logger; private readonly generateRequestId; private readonly logLifecycle; private readonly logAbort; constructor(options?: PinoHandlerPluginOptions); init(options: StandardHandlerOptions): StandardHandlerOptions; } export { LOGGER_CONTEXT_SYMBOL, PinoHandlerPlugin, getLogger }; export type { LoggerContext, PinoHandlerPluginOptions };