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

Read the ROSCONSOLE_FORMAT env var to format the logs #174

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

romainreignier
Copy link
Contributor

This is a naive approach, not much optimized because each call to String::replace() will allocate a new String, a bit like the rospy implementation.

I did not implement the tokens for which the value were not already available. This can be done later.

The new thread-id dependency should not bring too much new dependencies as it only requires libc on Linux for example.

I have added a space to INFO and WARN level strings so all levels have the same string length.
I did this to mimic rosconsole.
But I have just noticed that on the noetic-devel branch, not yet released, the spaces are gone thanks to this PR ros/rosconsole#52
I personally prefer the space so the logs are well aligned.

To implement several loggers, we would need a more advanced logging system. Did you try to use the existing rust log ecosystem and create a rosrust backend for it?

@romainreignier
Copy link
Contributor Author

romainreignier commented Aug 4, 2022

Note that I did not add test because I do not know how to capture stdout in the tests.
We would need to use write!() to an object that would be stdout by default but a buffer for the tests.

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.

None yet

1 participant