Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decoder: add support for nested log formatting #778

Merged
merged 19 commits into from
Oct 2, 2023

Conversation

andresovela
Copy link
Contributor

@andresovela andresovela commented Oct 1, 2023

This PR is a follow-up for #769.

This adds support for nesting formats, allowing users to specify formatting for groups of log segments at once.
For example, "{[{L:bold}]%underline} {s}" prints "[ERROR] Something went wrong" where ERROR is bold, and [ERROR] is underlined from [to ].

This nesting feature also enables aligning groups of log segments at once, which allows users to format their logs like this:

   54251 [INFO ] main.rs:543   Something happened
  400241 [ERROR] parser.rs:86  Failed to parse input 

I think the formatting feature is pretty much complete with this PR, and I don't have plans to extend it any further at this point.

That said, I do intend to submit a PR to propose a new default format after this is merged.

I'm looking forward to finally have this in defmt :)

Copy link
Member

@Urhengulas Urhengulas left a comment

Choose a reason for hiding this comment

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

Thank you. I have two questions, but otherwise it seems good to me.

decoder/src/log/format.rs Show resolved Hide resolved
decoder/src/log/format.rs Show resolved Hide resolved
@Urhengulas Urhengulas enabled auto-merge October 2, 2023 14:16
@Urhengulas Urhengulas added this pull request to the merge queue Oct 2, 2023
Merged via the queue into knurling-rs:main with commit 729c374 Oct 2, 2023
14 checks passed
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