{
  "type": "module",
  "source": "doc/api/api-debug.md",
  "miscs": [
    {
      "textRaw": "Debug",
      "name": "Debug",
      "type": "misc",
      "desc": "<p>Undici emits human-readable debug logs through Node.js' built-in\n<a href=\"https://nodejs.org/api/util.html#utildebuglogsection-callback\"><code>util.debuglog()</code></a>. The logs are disabled by default and are turned on by\nlisting one or more namespaces in the <code>NODE_DEBUG</code> environment variable. Because\n<code>util.debuglog()</code> reads <code>NODE_DEBUG</code> once, when the namespace is first used, the\nvariable must be set before the process starts.</p>\n<p>Each log line is prefixed with the namespace (uppercased) and the process id,\nfor example <code>UNDICI 16241: connecting to nodejs.org using https:h1</code>. Multiple\nnamespaces can be enabled at once by separating them with commas, for example\n<code>NODE_DEBUG=undici,websocket</code>.</p>\n<p>The following sections describe the namespaces exposed by undici.</p>",
      "miscs": [
        {
          "textRaw": "`undici`",
          "name": "`undici`",
          "type": "misc",
          "desc": "<p>Enables debug logs for the core undici library, covering connection setup,\nrequest dispatch, responses, and trailers. The <code>fetch</code> and <code>websocket</code> APIs are\nbuilt on top of this core, so enabling <code>undici</code> also surfaces activity that\noriginates from them.</p>\n<pre><code class=\"language-console\">$ NODE_DEBUG=undici node script.js\nUNDICI 16241: connecting to nodejs.org using https:h1\nUNDICI 16241: connecting to nodejs.org using https:h1\nUNDICI 16241: connected to nodejs.org using https:h1\nUNDICI 16241: sending request to GET https://nodejs.org/\nUNDICI 16241: received response to GET https://nodejs.org/ - HTTP 307\nUNDICI 16241: connecting to nodejs.org using https:h1\nUNDICI 16241: trailers received from GET https://nodejs.org/\nUNDICI 16241: connected to nodejs.org using https:h1\nUNDICI 16241: sending request to GET https://nodejs.org/en\nUNDICI 16241: received response to GET https://nodejs.org/en - HTTP 200\nUNDICI 16241: trailers received from GET https://nodejs.org/en\n</code></pre>",
          "displayName": "`undici`"
        },
        {
          "textRaw": "`fetch`",
          "name": "`fetch`",
          "type": "misc",
          "desc": "<p>Enables debug logs scoped to the <code>fetch</code> API. The output mirrors the <code>undici</code>\nnamespace but is emitted only for requests made through <a href=\"Fetch.html\"><code>fetch()</code></a>, which\nmakes it useful for isolating <code>fetch</code> traffic from other undici activity.</p>\n<pre><code class=\"language-console\">$ NODE_DEBUG=fetch node script.js\nFETCH 16241: connecting to nodejs.org using https:h1\nFETCH 16241: connecting to nodejs.org using https:h1\nFETCH 16241: connected to nodejs.org using https:h1\nFETCH 16241: sending request to GET https://nodejs.org/\nFETCH 16241: received response to GET https://nodejs.org/ - HTTP 307\nFETCH 16241: connecting to nodejs.org using https:h1\nFETCH 16241: trailers received from GET https://nodejs.org/\nFETCH 16241: connected to nodejs.org using https:h1\nFETCH 16241: sending request to GET https://nodejs.org/en\nFETCH 16241: received response to GET https://nodejs.org/en - HTTP 200\nFETCH 16241: trailers received from GET https://nodejs.org/en\n</code></pre>",
          "displayName": "`fetch`"
        },
        {
          "textRaw": "`websocket`",
          "name": "`websocket`",
          "type": "misc",
          "desc": "<p>Enables debug logs scoped to the <a href=\"WebSocket.html#class-websocket\"><code>WebSocket</code></a> API, covering the opening\nhandshake and connection lifecycle. When the <code>undici</code> or <code>fetch</code> namespace is\nalso enabled, some lines may appear under both namespaces because the handshake\nis performed through the core library.</p>\n<pre><code class=\"language-console\">$ NODE_DEBUG=websocket node script.js\nWEBSOCKET 18309: connecting to echo.websocket.org using https:h1\nWEBSOCKET 18309: connected to echo.websocket.org using https:h1\nWEBSOCKET 18309: sending request to GET https://echo.websocket.org/\nWEBSOCKET 18309: connection opened &#x3C;ip_address>\n</code></pre>",
          "displayName": "`websocket`"
        }
      ]
    }
  ]
}