Skip to content

feat: add --log-file and --log-level options#148

Merged
jpnurmi merged 4 commits into
getsentryfrom
jpnurmi/feat/log-file
Apr 20, 2026
Merged

feat: add --log-file and --log-level options#148
jpnurmi merged 4 commits into
getsentryfrom
jpnurmi/feat/log-file

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Adds --log-file and --log-level options for the crashpad backend in sentry-native:

Forward log-file path and minimum severity to mini_chromium (getsentry/mini_chromium#6), so handler log output can be redirected to a file and filtered to the requested severity.

  • --log-file=FILE writes handler log output to FILE using the LOG_TO_FILE destination.
  • --log-level=N sets the minimum LogSeverity that is emitted (-1=verbose, 0=info, 1=warning, 2=error, 4=fatal). Default remains LOG_INFO.

Both options are pre-scanned from argv before InitCrashpadLogging so they take effect early enough to cover option-parse diagnostics.

See also:

@jpnurmi jpnurmi force-pushed the jpnurmi/feat/log-file branch 2 times, most recently from 2b84464 to 2722651 Compare April 17, 2026 07:33
@jpnurmi jpnurmi changed the title feat: add --log-file option feat: add --log-file and --log-level options Apr 17, 2026
@jpnurmi jpnurmi force-pushed the jpnurmi/feat/log-file branch from 2722651 to feb2918 Compare April 17, 2026 11:17
@jpnurmi jpnurmi force-pushed the jpnurmi/feat/log-file branch from 9685be5 to 4045618 Compare April 18, 2026 12:09
jpnurmi and others added 3 commits April 20, 2026 12:07
For testing LOG_TO_FILE support end-to-end before it lands in
getsentry/mini_chromium.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Forward the path to mini_chromium via LoggingSettings::log_file_path,
so handler log output is written to the specified file using the
LOG_TO_FILE destination.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Accept `--log-level=N` and apply it to mini_chromium's minimum log
severity before any logging occurs. Pre-scanned from argv alongside
`--log-file=` so option-parse diagnostics are already filtered. N is
the LogSeverity integer (-1=verbose, 0=info, 1=warning, 2=error,
4=fatal).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jpnurmi jpnurmi force-pushed the jpnurmi/feat/log-file branch from e000ad6 to 401d49e Compare April 20, 2026 10:09
@jpnurmi jpnurmi marked this pull request as ready for review April 20, 2026 10:11
Comment thread handler/handler_main.cc

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 401d49e. Configure here.

Comment thread handler/handler_main.cc
The argv pre-scan only matched the --log-file=VALUE form, so the
space-separated form accepted by getopt_long (--log-file VALUE) was
silently ignored and logging was never configured from it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jpnurmi jpnurmi force-pushed the jpnurmi/feat/log-file branch from 66f988e to b76f0c8 Compare April 20, 2026 10:53
@jpnurmi jpnurmi merged commit 4a755de into getsentry Apr 20, 2026
20 checks passed
@jpnurmi jpnurmi deleted the jpnurmi/feat/log-file branch April 20, 2026 13:44
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.

3 participants