You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(logger): inject --verbose and --log-level as proper Stricli flags
Fix three bugs in the logging system introduced in #338:
1. `--verbose` rejected by all commands except `api` — Stricli throws
"No flag registered for --verbose" because extractLogLevelFromArgs
intentionally left it in argv for the api command.
2. `--log-level=debug` (equals form) not handled — argv.indexOf only
matched the space-separated form, passing the flag through to Stricli.
3. `SENTRY_LOG_LEVEL` env var has no visible effect — consola withTag()
creates independent instances that snapshot the level at creation time.
Module-level scoped loggers never saw later setLogLevel() calls.
Instead of pre-parsing flags from argv (bypassing Stricli), define them as
proper hidden Stricli flags. buildCommand in src/lib/command.ts now wraps
Stricli to inject hidden --log-level (enum) and --verbose (boolean) flags
into every command, intercept them, apply setLogLevel(), then strip them
before calling the original func.
When a command already defines its own --verbose (e.g. api uses it for HTTP
output), the injected one is skipped — the command own value still triggers
debug-level logging as a side-effect.
setLogLevel() now propagates to all withTag() children via a registry,
fixing the env var and flag having no effect on scoped loggers.
Document SENTRY_LOG_LEVEL, --log-level, and --verbose in configuration
docs.
* **Shared pagination infrastructure: buildPaginationContextKey and parseCursorFlag**: List commands with cursor pagination use \`buildPaginationContextKey(type, identifier, flags)\` for composite context keys and \`parseCursorFlag(value)\` accepting \`"last"\` magic value. Critical: \`resolveCursor()\` must be called inside the \`org-all\` override closure, not before \`dispatchOrgScopedList\` — otherwise cursor validation errors fire before the correct mode-specific error.
* **Telemetry instrumentation pattern: withTracingSpan + captureException for handled errors**: For graceful-fallback operations, use \`withTracingSpan\` from \`src/lib/telemetry.ts\` for child spans and \`captureException\` from \`@sentry/bun\` (named import — Biome forbids namespace imports) with \`level: 'warning'\` for non-fatal errors. \`withTracingSpan\` uses \`onlyIfParent: true\` so it's a no-op without active transaction. When returning \`withTracingSpan(...)\` directly, drop \`async\` and use \`Promise.resolve(null)\` for early returns. User-visible fallbacks should use \`log.warn()\` not \`log.debug()\` — debug is invisible at default level. Also: several commands bypass telemetry by importing \`buildCommand\` from \`@stricli/core\` directly instead of \`../../lib/command.js\`. Affected: trace/list, trace/view, log/view, api.ts, help.ts.
689
+
* **Telemetry instrumentation pattern: withTracingSpan + captureException for handled errors**: For graceful-fallback operations, use \`withTracingSpan\` from \`src/lib/telemetry.ts\` for child spans and \`captureException\` from \`@sentry/bun\` (named import — Biome forbids namespace imports) with \`level: 'warning'\` for non-fatal errors. \`withTracingSpan\` uses \`onlyIfParent: true\` so it's a no-op without active transaction. When returning \`withTracingSpan(...)\` directly, drop \`async\` and use \`Promise.resolve(null)\` for early returns. User-visible fallbacks should use \`log.warn()\` not \`log.debug()\` — debug is invisible at default level. \`buildCommand\` in \`src/lib/command.ts\` wraps Stricli's \`buildCommand\` to inject hidden \`--log-level\` (enum) and \`--verbose\` (boolean) flags, telemetry capture, and logging setup into every command. When a command already defines its own \`--verbose\` (e.g. \`api\` uses it for HTTP output), the injected one is skipped — the command's own value still triggers debug-level logging as a side-effect. Consola's \`withTag()\` creates independent instances — \`setLogLevel()\` propagates to all children via a registry.
Equivalent to passing `--log-level debug` on the command line. CLI flags take precedence over the environment variable.
103
+
92
104
### `SENTRY_CLI_NO_UPDATE_CHECK`
93
105
94
106
Disable the automatic update check that runs periodically in the background.
@@ -97,6 +109,33 @@ Disable the automatic update check that runs periodically in the background.
97
109
export SENTRY_CLI_NO_UPDATE_CHECK=1
98
110
```
99
111
112
+
## Global Options
113
+
114
+
These flags are accepted by every command. They are not shown in individual command `--help` output, but are always available.
115
+
116
+
### `--log-level <level>`
117
+
118
+
Set the log verbosity level. Accepts: `error`, `warn`, `log`, `info`, `debug`, `trace`.
119
+
120
+
```bash
121
+
sentry issue list --log-level debug
122
+
sentry --log-level=trace cli upgrade
123
+
```
124
+
125
+
Overrides `SENTRY_LOG_LEVEL` when both are set.
126
+
127
+
### `--verbose`
128
+
129
+
Shorthand for `--log-level debug`. Enables debug-level diagnostic output.
130
+
131
+
```bash
132
+
sentry issue list --verbose
133
+
```
134
+
135
+
:::note
136
+
The `sentry api` command also uses `--verbose` to show full HTTP request/response details. When used with `sentry api`, it serves both purposes (debug logging + HTTP output).
137
+
:::
138
+
100
139
## Credential Storage
101
140
102
141
Credentials are stored in a SQLite database at `~/.sentry/` (or the path set by `SENTRY_CONFIG_DIR`) with restricted file permissions (mode 600) for security. The database also caches:
0 commit comments