Skip to content

Commit 7b0c429

Browse files
committed
chore(debug): trim redundant comments in API debug logging
1 parent 9dffe43 commit 7b0c429

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

packages/cli/src/utils/debug.mts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,12 @@ function buildApiDebugDetails(
141141
}
142142

143143
/**
144-
* Debug an API response with detailed request information.
144+
* Debug an API response. Only failed requests (error or status >= 400)
145+
* produce structured output; successful responses optionally log a
146+
* one-liner at the `notice` debug namespace.
145147
*
146-
* For failed requests (status >= 400 or error), logs a structured
147-
* object with:
148-
* - endpoint (human-readable description)
149-
* - requestedAt (ISO timestamp, if passed)
150-
* - method, url, durationMs
151-
* - sanitized request headers (Authorization redacted)
152-
* - cfRay (extracted from response headers if present)
153-
* - sanitized response headers
154-
* - responseBody (truncated)
155-
*
156-
* All request-headers are sanitized to redact Authorization and
157-
* `*api-key*` values.
148+
* Request and response headers are sanitized via `sanitizeHeaders` so
149+
* Authorization and `*api-key*` values are redacted.
158150
*/
159151
export function debugApiResponse(
160152
endpoint: string,
@@ -173,7 +165,6 @@ export function debugApiResponse(
173165
),
174166
)
175167
} else if (status && status >= 400) {
176-
// For failed requests, log detailed information.
177168
if (requestInfo) {
178169
debugDir(buildApiDebugDetails({ endpoint, status }, requestInfo))
179170
} else {

packages/cli/src/utils/socket/api.mts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,9 @@ export async function queryApiSafeText(
487487
if (!result.ok) {
488488
const { status } = result
489489
const durationMs = Date.now() - startTime
490-
// Log detailed error information — include response headers (for
491-
// cf-ray) and a truncated body so support tickets have everything
492-
// needed to file against Cloudflare or backend teams.
490+
// Include response headers (for cf-ray) and a truncated body so
491+
// support tickets have everything needed to file against Cloudflare
492+
// or backend teams.
493493
debugApiResponse(description || 'Query API', status, undefined, {
494494
method: 'GET',
495495
url: fullUrl,
@@ -673,9 +673,9 @@ export async function sendApiRequest<T>(
673673
if (!result.ok) {
674674
const { status } = result
675675
const durationMs = Date.now() - startTime
676-
// Log detailed error information — include response headers (for
677-
// cf-ray) and a truncated body so support tickets have everything
678-
// needed to file against Cloudflare or backend teams.
676+
// Include response headers (for cf-ray) and a truncated body so
677+
// support tickets have everything needed to file against Cloudflare
678+
// or backend teams.
679679
debugApiResponse(description || 'Send API Request', status, undefined, {
680680
method,
681681
url: fullUrl,

0 commit comments

Comments
 (0)