fix: add logging for TOML AST parsing errors#1606
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
tracelevel 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); |
There was a problem hiding this comment.
{:#?} 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.