Skip to content

fix(logging): 🐛 improve RUST_LOG env var parsing to fix default log level - #158

Merged
jorben merged 1 commit into
masterfrom
refactor/log-env-filter
Apr 30, 2026
Merged

fix(logging): 🐛 improve RUST_LOG env var parsing to fix default log level#158
jorben merged 1 commit into
masterfrom
refactor/log-env-filter

Conversation

@HayWolf

@HayWolf HayWolf commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace EnvFilter::try_from_default_env() with explicit std::env::var("RUST_LOG") check in init_logging()
  • Fix an issue where tiycore warn logs were not captured to log files unless RUST_LOG was explicitly set
  • The previous try_from_default_env() API in tracing-subscriber 0.3.23 did not reliably error when RUST_LOG was unset, causing the default info level fallback to never trigger

Changes

  • src-tauri/src/lib.rs: Replace EnvFilter::try_from_default_env() fallback pattern with explicit match std::env::var("RUST_LOG") guard, ensuring the default info,sqlx=warn filter is correctly applied when RUST_LOG is not set

Test Plan

  • Verify tiycore warn logs appear in log files without setting RUST_LOG
  • Verify RUST_LOG=tiycore=debug still works to override default level
  • Verify invalid RUST_LOG values fall back to default gracefully

🤖 Generated with TiyCode

Replace try_from_default_env with manual parsing using FromStr
to handle empty or invalid RUST_LOG values gracefully.
@github-actions

Copy link
Copy Markdown

AI Code Review Summary

PR: #158 (fix(logging): 🐛 improve RUST_LOG env var parsing to fix default log level)
Preferred language: English

Overall Assessment

No blocking issue was detected in the reviewed diff; keep focused regression testing before merge.

Major Findings by Severity

No major issues identified from the reviewed diff.

Actionable Suggestions

  • Add a comment clarifying the intended behavior for an empty RUST_LOG vs. unset RUST_LOG.

Potential Risks

  • Potential hidden risks remain in edge cases not covered by the current diff context.

Test Suggestions

  • Add happy-path + boundary + failure-path tests for touched modules.

File-Level Coverage Notes

  • src-tauri/src/lib.rs: mostly safe with one minor behavior change to note

Inline Downgraded Items (processed but not inline)

  • None

Coverage Status

  • Target files: 1
  • Covered files: 1
  • Uncovered files: 0
  • No-patch/binary covered as file-level: 0
  • Findings with unknown confidence (N/A): 0

Uncovered list:

  • None

No-patch covered list:

  • None

Runtime/Budget

  • Rounds used: 1/4
  • Planned batches: 1
  • Executed batches: 1
  • Sub-agent runs: 1
  • Planner calls: 1
  • Reviewer calls: 1
  • Model calls: 2/64
  • Structured-output summary-only degradation: NO

@github-actions github-actions 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.

Automated PR review completed.

  • Findings kept: 0
  • Findings with unknown confidence: 0
  • Inline comments attempted: 1
  • Target files: 1
  • Covered files: 1
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

Comment thread src-tauri/src/lib.rs
@@ -7,6 +7,7 @@ mod persistence;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review completed for this PR diff. No concrete inline issue was selected after aggregation.

@jorben
jorben merged commit 5c30377 into master Apr 30, 2026
4 checks passed
@jorben
jorben deleted the refactor/log-env-filter branch April 30, 2026 01:34
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