Skip to content

[Rust] Log selected backend log format at startup#13

Open
therealsaitama0 wants to merge 4 commits into
Andyyook:mainfrom
therealsaitama0:bounty2-log-format-startup
Open

[Rust] Log selected backend log format at startup#13
therealsaitama0 wants to merge 4 commits into
Andyyook:mainfrom
therealsaitama0:bounty2-log-format-startup

Conversation

@therealsaitama0

@therealsaitama0 therealsaitama0 commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Adds a startup log field for the selected backend log format (TOT_LOG_FORMAT) so operators can confirm text/json mode from startup logs.

Changes

  • backend/src/logging.rs: New module with
    esolve_log_format() helper that reads TOT_LOG_FORMAT, defaults to ext, accepts json, and returns an error for invalid values.
  • backend/src/lib.rs: Registers the new logging module.
  • backend/src/main.rs: Calls
    esolve_log_format() before initializing tracing, selects JSON or plain text formatter based on the resolved format, and includes log_format in the startup info event.
  • docs/OPERATIONS.md: Documents the TOT_LOG_FORMAT environment variable and the log_format startup confirmation field.

Testing

  • cargo test --lib passes all logging unit tests:
    • defaults_to_text_when_unset
    • �ccepts_text
    • �ccepts_json

ejects_invalid_value

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

  • I would like to request that my diagnostic build log is removed before merging

Payment

ETHEREUM ADDRESS: 0x5e1040927a1E28D740f92De27a3d493b81682D88

- Add argparse CLI with --verbose, --json, --threshold flags
- Wrap subprocess.run calls in try/except with meaningful error messages
- Support --json output for machine consumption
- Allow --threshold N for minimum passing modules (default: 0)
- Validate diagnostic JSON schema on read and report structural errors
- Add pytest tests for schema validation and verification logic
@therealsaitama0 therealsaitama0 force-pushed the bounty2-log-format-startup branch from 5949a0b to 0fafc9e Compare June 29, 2026 11:04
@therealsaitama0 therealsaitama0 force-pushed the bounty2-log-format-startup branch from 0fafc9e to c6f3a0f Compare June 29, 2026 11:20
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.

2 participants