Skip to content

feat: add global --log-level option#170

Merged
rhuanbarreto merged 2 commits intomainfrom
feat/global-log-level
Mar 24, 2026
Merged

feat: add global --log-level option#170
rhuanbarreto merged 2 commits intomainfrom
feat/global-log-level

Conversation

@rhuanbarreto
Copy link
Copy Markdown
Contributor

Summary

  • Global --log-level option — Adds --log-level <error|warn|info|debug> (default: info) to the root archgate command. All subcommands inherit it. Use --log-level debug instead of DEBUG=1 for easier troubleshooting (e.g., archgate --log-level debug upgrade)
  • Log level gatinglogInfo() and logWarn() now respect the active log level, so --log-level error silences everything except errors
  • Sentry breadcrumb tracinglogDebug, logError, and logWarn calls are now captured as Sentry breadcrumbs via a callback hook (avoids circular dependency between log.ts and sentry.ts). When an error is reported to Sentry, the breadcrumb trail shows the sequence of log events leading to it
  • Backward compatibleDEBUG=1 env var still works as a shortcut for --log-level debug

Test plan

  • bun test tests/helpers/log.test.ts — 10/10 pass
  • bun test tests/helpers/sentry.test.ts — 8/8 pass
  • archgate check — 22/22 ADR checks pass
  • bun run build:check — build compiles
  • archgate --log-level debug upgrade shows debug output
  • archgate --log-level error check suppresses info/warn output

- Add global --log-level <error|warn|info|debug> option (default: info)
  to control CLI log verbosity without environment variables
- Connect logDebug/logError/logWarn to Sentry breadcrumbs via a
  callback hook (avoids circular dependency between log.ts and sentry.ts)
- logInfo/logWarn now respect the log level (previously always emitted)
- DEBUG=1 env var still works as a shortcut for --log-level debug
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 24, 2026

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3747b84
Status: ✅  Deploy successful!
Preview URL: https://6050e564.archgate-cli.pages.dev
Branch Preview URL: https://feat-global-log-level.archgate-cli.pages.dev

View logs

Add logDebug calls to critical code paths that previously had no
diagnostic output, making --log-level debug useful for troubleshooting:

- upgrade command: install method detection, version comparison,
  binary download, external upgrade process spawning
- binary-upgrade: GitHub API fetch, download size, archive extraction,
  binary replacement
- auth: device code request/polling, GitHub user fetch, token claim
- login-flow: step-by-step flow progress, signup fallback
- signup: request submission and response status
- editor-detect: detection results for all editors
- git-files: all git commands, file counts, error fallbacks
@rhuanbarreto rhuanbarreto merged commit 972028e into main Mar 24, 2026
8 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/global-log-level branch March 24, 2026 14:16
@github-actions github-actions bot mentioned this pull request Mar 24, 2026
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.

1 participant