← Back to PRs

#9461: refactor(cli): replace console.warn with SubsystemLogger in health.ts

by dinakars777 open 2026-02-05 07:33 View on GitHub →
commands agents size: XS
## Description Refactors `src/commands/health.ts` to use the standardized `SubsystemLogger` for debug output instead of direct `console.warn` calls. ## Motivation This aligns the health command with the project's logging standards, ensuring debug messages are correctly controlled by the logging subsystem configuration. ## Changes - Replaced `console.warn` with `log.warn` inside `debugHealth`. - Initialized `createSubsystemLogger("commands/health")`. - Preserved `OPENCLAW_DEBUG_HEALTH` env var check. ## Tests - Verified with `npm run build` (Passed). <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR standardizes warning/debug output by replacing `console.warn` with `SubsystemLogger` in: - `src/commands/health.ts` (health command debug output) - `src/agents/compaction.ts` (summarization fallback warnings) It also removes an unused import from `src/cron/isolated-agent/run.ts` as part of prior related logging/thinking-level cleanup. Overall this aligns CLI/agent output with the repo’s logging subsystem so warnings can be controlled by configuration rather than always printing to stderr. <h3>Confidence Score: 3/5</h3> - This PR is close to mergeable but currently breaks typechecking and adds a debug-only crash case. - Confidence reduced due to a definite missing type import in `health.ts` and a new runtime throw path when debug logging is enabled (JSON.stringify on unknown args). Other changes look consistent with existing SubsystemLogger usage patterns. - src/commands/health.ts <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs