outlogger
Version:
Log outgoing network requests
52 lines (42 loc) • 904 B
TypeScript
/// <reference types="node" />
// index.d.ts
interface LogOptions {
/**
* Enable or disable logging.
* @default true
*/
enable?: boolean
/**
* Include query parameters in the log.
* @default false
*/
params?: boolean
/**
* Include request body in the log.
* @default false
*/
body?: boolean
/**
* Include headers in the log.
* @default false
*/
headers?: boolean
/**
* Enable all logging: params, body, and headers.
* @default false
*/
verbose?: boolean
}
/**
* Monkey-patches HTTP, HTTPS, and fetch to log outgoing requests.
* Call this once to start logging.
*
* @param options Configuration for what to log
*/
declare function outlogger(options?: LogOptions): void
/**
* Restores the original HTTP, HTTPS, and fetch methods.
*/
declare function restore(): void
export { outlogger, restore };
export type { LogOptions };