Skip to content

feat: add client debug mode - #18

Merged
dariyaanis merged 31 commits into
mainfrom
feature/sdk-debug-mode
Nov 13, 2026
Merged

dariyaanis merged 31 commits into
mainfrom
feature/sdk-debug-mode

Conversation

@dariyaanis

@dariyaanis dariyaanis commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add opt-in debug logging to CaptchaClient through debug: true
  • log timestamped API requests, parsed server responses, errors, HTTP status, and request duration
  • keep routine processing polls compact while showing request/response details for task creation, errors, and ready results
  • print a final solve() summary with status, task ID/type, elapsed time, server solve time when available, and poll count
  • mask client keys, authorization, cookies, and proxy details
  • replace base64 image data with its length and shorten other long strings
  • ensure debug formatting failures never change request results
  • add a standalone examples/debug_mode.js example
  • add How it works / STEP-* comments to all examples
  • print the Kaleidoscope result as formatted JSON
  • document debug mode and the runnable examples in README

Usage

const client = new CaptchaClient({
  clientKey: 'your_api_key',
  debug: true
});

Debug mode is disabled by default. Review logs before sharing them because URLs and custom task fields may contain application-specific data.

Run the bundled debug example with a valid API key in .env:

npm run build
node examples/debug_mode.js

The example creates a real paid CAPTCHA task.

Validation

  • npm run typecheck
  • npm run test:unit -- --runInBand — 24 suites and 129 tests passed
  • node --check for JavaScript examples
  • git diff --check

dariyaanis and others added 30 commits November 12, 2026 16:47
- prefix every debug line with local time, milliseconds and UTC offset
- one line per API request; REQUEST (POST <url>) and RESPONSE (HTTP ...)
  blocks for task creation, balance, errors and ready results only
- mask credentials as [MASKED], replace base64 images with their length
- log the error the caller receives, including fetch failure causes
- print SOLVE SUMMARY line by line with serverSolveTime and error

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the server never answers (connection refused, timeout), print
"RESPONSE: none - no response from the server (<ErrorName>)" so every
logged request shows what happened to its response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dariyaanis
dariyaanis merged commit 93c0f9c into main Nov 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants