Skip to content

fix(api): replace debug console.log with console.warn in production handlers#827

Closed
NewCoder3294 wants to merge 2 commits intokoala73:mainfrom
NewCoder3294:fix/console-log-cleanup
Closed

fix(api): replace debug console.log with console.warn in production handlers#827
NewCoder3294 wants to merge 2 commits intokoala73:mainfrom
NewCoder3294:fix/console-log-cleanup

Conversation

@NewCoder3294
Copy link
Contributor

Summary

Cleans up console.log usage in server handler files under server/worldmonitor/. All 20 console.log calls were either upgraded to console.warn (for operationally significant messages) or removed (debug/trace noise).

Changes by file

server/worldmonitor/military/v1/get-usni-fleet-report.ts (4 calls):

  • Removed [USNI Fleet] Fetching from WordPress API... — debug trace, fires every fetch
  • Upgraded to console.warn [USNI Fleet] Parsed: N vessels, N CSGs, N regions — operational summary worth monitoring
  • Removed [USNI Fleet] Cache hit — routine cache behavior, pure noise
  • Upgraded to console.warn [USNI Fleet] Returning stale cached data — noteworthy fallback condition (serving stale data after an error)

server/worldmonitor/aviation/v1/_shared.ts (10 calls):

  • Upgraded to console.warn [Aviation] No AVIATIONSTACK_API key — skipping — missing API key is noteworthy
  • Removed [Aviation] Querying N airports (concurrency=N) — debug trace on every batch run
  • Upgraded to console.warn [Aviation] Done: N ok, N failed, N alerts, healthy=bool — operational summary with failure counts
  • Removed [Aviation] IATA: N flights, N cancelled, N delayed — per-airport trace, extremely chatty
  • Upgraded to console.warn [Aviation] NOTAM: no ICAO_API_KEY — skipping — missing API key
  • Removed [Aviation] NOTAM: fetching via relay for N airports — debug trace
  • Removed [Aviation] NOTAM: fetching direct for N airports — debug trace
  • Removed [Aviation] NOTAM: N raw NOTAMs received — debug trace
  • Upgraded to console.warn [Aviation] NOTAM closures: ICAO, ICAO, ... — actual airport closures detected, operationally significant
  • Removed [Aviation] NOTAM: no closures found — routine no-op, noise

server/worldmonitor/aviation/v1/list-airport-delays.ts (6 calls + 1 dead variable):

  • Removed [Aviation] FAA: N alerts — debug trace
  • Upgraded to console.warn [Aviation] No AVIATIONSTACK_API key — using simulation — fallback to simulation mode
  • Removed [Aviation] AviationStack OK: N real alerts — debug trace
  • Removed [Aviation] Intl: N alerts — debug trace
  • Upgraded to console.warn [Aviation] NOTAM: N closures applied — operationally significant overlay
  • Removed [Aviation] Total: N alerts (N normal) in Nms — debug summary; also removed the now-unused t0 timing variable
  • Removed dead code block: if (flights.length > 0) block in fetchSingleAirport that only computed unused cancelled/delayed variables after their log was removed

Rationale

Decision Criteria
Upgrade to console.warn Operational condition worth monitoring: missing API keys, fallback behavior, stale data served, actual closures detected, batch completion summaries
Remove entirely Debug/trace noise: "Fetching from...", "N results parsed", per-item traces, cache hits, routine totals

All existing console.warn and console.error calls were left untouched. No new logging was added. Log prefix format (e.g., [USNI Fleet], [Aviation]) is preserved on all upgraded messages.

Test plan

  • Verify TypeScript compilation passes (tsc --noEmit)
  • Confirm no remaining console.log calls in server/worldmonitor/
  • Verify aviation and military endpoints still function with expected warn-level output

🤖 Generated with Claude Code

NewCoder3294 and others added 2 commits March 2, 2026 13:07
…tion handlers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 2, 2026

@NewCoder3294 is attempting to deploy a commit to the Elie Team on Vercel.

A member of the Team first needs to authorize it.

@koala73 koala73 added Not Ready to Merge PR has conflicts, failing checks, or needs work High Value Meaningful contribution to the project labels Mar 3, 2026
koala73 added a commit that referenced this pull request Mar 6, 2026
Supersedes #827 (rebased on current main with seed-based paths).
All 21 console.log calls in server/worldmonitor/ either upgraded to
console.warn (missing API keys, stale fallbacks, operational summaries,
closures detected) or removed (debug traces, cache hits, per-item noise).
Removes dead code block in fetchSingleAirport after its log was removed.

Co-authored-by: Nicolas Dos Santos <NewCoder3294@users.noreply.github.com>
@koala73
Copy link
Owner

koala73 commented Mar 6, 2026

Thank you - swamped, just got to it, but app got a big architecture update so #1097

@koala73 koala73 closed this Mar 6, 2026
koala73 added a commit that referenced this pull request Mar 6, 2026
…ers (#1097)

Supersedes #827 (rebased on current main with seed-based paths).
All 21 console.log calls in server/worldmonitor/ either upgraded to
console.warn (missing API keys, stale fallbacks, operational summaries,
closures detected) or removed (debug traces, cache hits, per-item noise).
Removes dead code block in fetchSingleAirport after its log was removed.

Co-authored-by: Nicolas Dos Santos <NewCoder3294@users.noreply.github.com>
aldoyh pushed a commit to aldoyh/worldmonitor that referenced this pull request Mar 6, 2026
…ers (koala73#1097)

Supersedes koala73#827 (rebased on current main with seed-based paths).
All 21 console.log calls in server/worldmonitor/ either upgraded to
console.warn (missing API keys, stale fallbacks, operational summaries,
closures detected) or removed (debug traces, cache hits, per-item noise).
Removes dead code block in fetchSingleAirport after its log was removed.

Co-authored-by: Nicolas Dos Santos <NewCoder3294@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Value Meaningful contribution to the project Not Ready to Merge PR has conflicts, failing checks, or needs work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants