---
url: https://haihv.github.io/valifetch/api/index/type-aliases/DebugOption.md
---

# Type Alias: DebugOption

> **DebugOption** = `true` | ((`event`) => `void`)

Defined in: [src/types/options.ts:186](https://github.com/haihv/valifetch/blob/285835d38a6676b98d2ee1a93e23166c6c834cb2/src/types/options.ts#L186)

Controls structured debug logging of request lifecycle events.

* `true` — logs a plain summary of each event via `console.debug('[valifetch]', summary)`:
  `type`, `method`, `url`, request `headers`, plus `attempt`/`status`/`responseHeaders`
  (response) or `attempt`/`delay`/`reason` (retry). Values of headers, and of URL
  query parameters, whose name matches `auth`, `cookie`, `token`, `secret`, `key`,
  `session`, `pass`, `credential`, `sig`, `jwt`, `dpop`, `csrf`, `xsrf`, `otp`,
  `bearer` or `code` (case-insensitive substring) are replaced with `'[REDACTED]'`.
  Matching is deliberately broad, so some harmless names are redacted too. The URL
  path and fragment are logged as-is.
* function — receives each `DebugEvent` directly, with the live `Request`/`Response`
  (headers unredacted); redacting secrets is then the function's responsibility
