# `DocuSign.Debug`
[🔗](https://github.com/neilberkman/docusign_elixir/blob/v3.4.0/lib/docusign/debug.ex#L1)

Debugging and logging configuration for the DocuSign Elixir client.

This module provides functionality to configure debug logging for HTTP requests and responses,
similar to the Ruby DocuSign client's debugging capabilities.

## Configuration

Enable debugging by setting the `:debug` option in your application config:

    config :docusign, debug: true

You can also configure logging at runtime:

    DocuSign.Debug.enable_debugging()
    DocuSign.Debug.disable_debugging()

## Debug Logging

When debugging is enabled, the client will log:
- HTTP request method, URL, and headers
- HTTP request body (with sensitive data filtered)
- HTTP response status, headers, and body
- Request/response timing information

## Header Filtering

Sensitive headers like authorization tokens are automatically filtered in debug logs:

    config :docusign, :debug_filter_headers, ["authorization", "x-api-key"]

## Examples

    # Enable debugging for development
    config :docusign, debug: true

    # Configure debug settings
    config :docusign,
      debug: true,
      debug_filter_headers: ["authorization", "x-custom-secret"]

    # Or enable at runtime
    DocuSign.Debug.enable_debugging()

# `all_middleware`

> This function is deprecated. Use sdk_headers() directly with Req configuration.

```elixir
@spec all_middleware() :: list()
```

Get all middleware for DocuSign connections including debugging and SDK headers.

Note: This function is now deprecated as Req handles middleware differently.
Use sdk_headers() directly if needed.

# `debugging_enabled?`

```elixir
@spec debugging_enabled?() :: boolean()
```

Check if debugging is currently enabled.

# `disable_debugging`

```elixir
@spec disable_debugging() :: :ok
```

Disable debugging for DocuSign HTTP requests.

# `enable_debugging`

```elixir
@spec enable_debugging() :: :ok
```

Enable debugging for DocuSign HTTP requests.

This will enable debug logging for all DocuSign connections.

# `filter_headers`

```elixir
@spec filter_headers() :: [String.t()]
```

Get the list of headers to filter in debug logs.

Returns the configured filter headers or defaults to ["authorization"].

# `middleware`

> This function is deprecated. Use sdk_headers() directly with Req configuration.

```elixir
@spec middleware() :: list()
```

Build middleware for debugging based on current configuration.

Note: This function is now deprecated as Req handles middleware differently.

# `sdk_headers`

```elixir
@spec sdk_headers() :: [{String.t(), String.t()}]
```

Get SDK headers for identifying the Elixir client.

This adds the X-DocuSign-SDK header to identify the Elixir client,
matching the Ruby client's behavior.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
