DocuSign.Debug (DocuSign v2.2.3)
View SourceDebugging 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 :debugging
option in your application config:
config :docusign, debugging: 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, debugging: true
# Configure debug settings
config :docusign,
debugging: true,
debug_filter_headers: ["authorization", "x-custom-secret"]
# Or enable at runtime
DocuSign.Debug.enable_debugging()
Summary
Functions
Get all middleware for DocuSign connections including debugging and SDK headers.
Check if debugging is currently enabled.
Disable debugging for DocuSign HTTP requests.
Enable debugging for DocuSign HTTP requests.
Get the list of headers to filter in debug logs.
Build Tesla middleware for debugging based on current configuration.
Build Tesla middleware for SDK identification headers.
Functions
@spec all_middleware() :: list()
Get all middleware for DocuSign connections including debugging and SDK headers.
This is the main function used by the Connection module to build middleware.
@spec debugging_enabled?() :: boolean()
Check if debugging is currently enabled.
@spec disable_debugging() :: :ok
Disable debugging for DocuSign HTTP requests.
@spec enable_debugging() :: :ok
Enable debugging for DocuSign HTTP requests.
This will add Tesla.Middleware.Logger with debug options to all DocuSign connections.
@spec filter_headers() :: [String.t()]
Get the list of headers to filter in debug logs.
Returns the configured filter headers or defaults to ["authorization"].
@spec middleware() :: list()
Build Tesla middleware for debugging based on current configuration.
Returns a list of middleware to include in Tesla client configuration. If debugging is disabled, returns an empty list.
@spec sdk_headers() :: list()
Build Tesla middleware for SDK identification headers.
This adds the X-DocuSign-SDK header to identify the Elixir client, matching the Ruby client's behavior.