import { type ILogger } from '../logger/types.js'; import type { Nullable } from '../types/index.js'; import type { IRequestConfig } from './call.js'; /** Describes the way a request is logged. * * Useful for granular control over logging, especially in production. */ export type LogTypes = boolean | 'full' | LogTypes.Dir | { req?: boolean | LogTypes.LogFn; res?: boolean | LogTypes.LogFn; }; export declare namespace LogTypes { export type Dir = 'req' | 'res'; export type LogFn = (data: T) => void | string | any[]; /** * Get the enabled state of a log type. * @param type Log type to check. * @param dir Direction of log, either request or response. */ export function getIsEnabled(type: Nullable, dir: Dir): { enabled: boolean; formatter?: Nullable<(data: T) => unknown>; }; type PartialRequestConfig = Pick; /** * An example implementation for logging logic (overload for a request with no data). * * See the other overload for more details. */ export function logCall(logger: ILogger, cfg: PartialRequestConfig, dir: 'req'): void; /** * An example implementation for logging logic (overload for a request with data). * * * Skips logging if the request is a GET and has no data. * * Checks if logging is enabled for the given direction. * * Formats the data if a custom formatter is provided. * * Logs the data via specified logger. */ export function logCall(logger: ILogger, cfg: PartialRequestConfig, dir: 'res', responseData: unknown): void; export {}; }