Skip to content

feat: improve logger with self-contained log lines#94

Open
Thanaen wants to merge 2 commits intobetter-auth:mainfrom
Thanaen:better-logs
Open

feat: improve logger with self-contained log lines#94
Thanaen wants to merge 2 commits intobetter-auth:mainfrom
Thanaen:better-logs

Conversation

@Thanaen
Copy link
Copy Markdown

@Thanaen Thanaen commented Apr 1, 2026

Closes #95

Summary

  • Each log line now includes the HTTP method, URL, status code, and request duration so concurrent requests can be distinguished at a glance
  • Adds a logFormat: "legacy" option to preserve the previous log format for backward compatibility
  • Documents the new logFormat option in the logger docs

Before

ℹ Request being sent to: https://website.com/api/users
ℹ Request being sent to: https://website.com/api/posts
✓ Request succeeded { ... }         ← which one?
✗ Request failed with status: 401   ← which one?

After

ℹ [GET] https://website.com/api/users
ℹ [GET] https://website.com/api/posts
✓ [GET] https://website.com/api/users — 200 OK (145ms)
✗ [POST] https://website.com/api/posts — 401 Unauthorized (89ms)

Test plan

  • pnpm build in packages/logger — ESM/CJS bundles succeed
  • Manual test: create a fetch client with logger(), fire 2+ parallel requests, verify each log line is self-contained
  • Manual test: use logFormat: "legacy" and confirm old log messages are unchanged
  • Verify verbose: true still logs response bodies on success and error

🤖 Generated with Claude Code

…st tracing

Each log line now includes the HTTP method, URL, status code, and request
duration so concurrent requests can be distinguished at a glance. A
`logFormat: "legacy"` option preserves the previous format for backward
compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Thanaen Thanaen marked this pull request as ready for review April 1, 2026 10:12
Covers: self-contained log lines with method/URL/status/duration,
parallel request distinguishability, legacy format preservation,
verbose mode, and disabled logger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Logger: parallel requests produce ambiguous logs

1 participant