Skip to content

fix: add logging for TOML AST parsing errors#1606

Merged
ya7010 merged 1 commit intomainfrom
add_error_ast_log
Mar 20, 2026
Merged

fix: add logging for TOML AST parsing errors#1606
ya7010 merged 1 commit intomainfrom
add_error_ast_log

Conversation

@ya7010
Copy link
Copy Markdown
Collaborator

@ya7010 ya7010 commented Mar 20, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 20, 2026 09:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds trace-level logging to help diagnose TOML parse failures in the formatter by emitting an AST dump when the parser returns errors.

Changes:

  • Log the parsed TOML AST at trace level when parsing errors are present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

let (root, errors) = parsed.into_root_and_errors();

if !errors.is_empty() {
log::trace!("TOML AST with parsing errors: {:#?}", root);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

{:#?} pretty-Debug dump will traverse the entire syntax tree and (via RedToken's Debug) include token text snippets (up to ~25 chars each). That can leak potentially sensitive TOML contents into logs and can also produce very large trace output for big documents. Consider switching this to {:?} (non-alternate Debug) or logging a smaller summary (e.g., error count/ranges) instead of dumping the full AST with token text.

Suggested change
log::trace!("TOML AST with parsing errors: {:#?}", root);
log::trace!("TOML AST with parsing errors: {:?}", root);

Copilot uses AI. Check for mistakes.
@ya7010 ya7010 merged commit e0f324a into main Mar 20, 2026
27 checks passed
@ya7010 ya7010 deleted the add_error_ast_log branch March 20, 2026 12:46
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