Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

feat(client): add debug mode with configurable log levels#41

Merged
drichar merged 1 commit into
mainfrom
feat/debug-logger
Jan 13, 2026
Merged

feat(client): add debug mode with configurable log levels#41
drichar merged 1 commit into
mainfrom
feat/debug-logger

Conversation

@drichar
Copy link
Copy Markdown
Contributor

@drichar drichar commented Jan 13, 2026

Summary

Adds a debug logging system to the Deflex SDK with configurable log levels (none, info, debug, trace). This enables developers to get visibility into SDK operations during development and troubleshoot swap failures without exposing sensitive data like API keys.

Changes

  • Logger utility (logger.ts) - Level-based logging with automatic sanitization of sensitive fields (apiKey, algodToken, signatures, encrypted payloads)
  • Debug config - New debugLevel option in DeflexConfigParams with four levels: none (default), info, debug, trace
  • Swap failure diagnostics (debug.ts) - Detailed context logging when swap execution fails, including quote details, route info, and transaction state
  • Test coverage - 300 lines of comprehensive tests for the logger functionality

Usage

const client = new DeflexClient({
  apiKey: 'your-api-key',
  debugLevel: 'debug', // Enable debug logging
})

Test plan

  • Unit tests pass (pnpm test)
  • Type checking passes (pnpm typecheck)
  • Existing tests updated to accommodate logger changes

Add an optional debug mode for local development that is disabled by
default. The logger provides four levels: none, info, debug, and trace.

Key features:
- Internal Logger utility with level-based filtering and auto-sanitization
- Sensitive data (apiKey, algodToken, signatures) automatically redacted
- Strategic failure logging in execute() to capture swap failure context
- Zero overhead when disabled (default 'none' level)

Configure via debugLevel option on DeflexClient:
  new DeflexClient({ apiKey: '...', debugLevel: 'debug' })
@drichar drichar merged commit 420c41d into main Jan 13, 2026
1 check passed
@drichar drichar deleted the feat/debug-logger branch January 13, 2026 22:07
github-actions Bot added a commit that referenced this pull request Jan 13, 2026
# [1.8.0](v1.7.0...v1.8.0) (2026-01-13)

### Features

* **client:** add debug mode with configurable log levels ([#41](#41)) ([420c41d](420c41d))
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant