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

qemu-run does not pad the log level #913

Open
BenFordTytherington opened this issue Dec 9, 2024 · 2 comments
Open

qemu-run does not pad the log level #913

BenFordTytherington opened this issue Dec 9, 2024 · 2 comments

Comments

@BenFordTytherington
Copy link
Contributor

During trying out #910, I noticed that the decoded output contained extra spaces after the log level, e.g. "INFO Hello, World!" instead of "INFO Hello, World!". This seems to be added by defmt-print, as the implementation of qemu-run which decodes it straight away handles it correctly, producing only one space.

Command I ran was

qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -monitor none -semihosting-config enable=on,target=native -kernel ../target/thumbv7m-none-eabi/debug/log 

to produce frames, and then piped this into defmt-print -e ../target/thumbv7m-none-eabi/debug/log.
Also tried (with the same issue) writing to a file first and then cat that into defmt-print, modifying qemu-run (as suggested in #876) to output undecoded, and using a direct pipe as well as into a file first. I Think due to these tests that the issue is somewhere with defmt-print, rather than the frames being produced, or I would expect the same behaviour in qemu-run.

@jonathanpallant
Copy link
Contributor

I believe log levels are always padded with spaces so they are always 5 characters long. Otherwise you'd get jagged text alignment on the messages themselves.

@Urhengulas
Copy link
Member

Yes, that padding is intended in order to align the log messages. It's documented in https://defmt.ferrous-systems.com/custom-log-output#log-level---l: "The log level is padded to 5 characters by default, for alignment purposes."

We should eliminate the difference between qemu-run and defmt-print by adding the padding to qemu-run.

@Urhengulas Urhengulas changed the title defmt-print seems to add extra spaces to logs qemu-run does not pad the log level Dec 19, 2024
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

No branches or pull requests

3 participants