-
Notifications
You must be signed in to change notification settings - Fork 100
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
Consol formating ignores escape sequences #425
Comments
@iuhilnehc-ynos can you take a look at this if you have bandwidth? |
@SammyRamone it would be appreciated if you can try #426. thanks in advance. |
I don't have time today, but I will try to do it tomorrow. |
@clalancette i will go ahead to close this issue since this is behavior change, i believe we do not backport this to iron or humble. |
The RCUTILS_CONSOLE_OUTPUT_FORMAT environment variable is a very nice way to format the log output of ROS 2 to one's own liking. However, it does not allow using any escape sequences (e.g. \n or any color codes) in it. It think it would be nice if this works, as this would, for example, allow to print different parts of the message in different colors or to structure the information over multiple lines.
Simple example of the issue:
The '\n' is not interpreted as a new line (ASCII code 10) but as an '' and 'n' (ASCII code 92 and 110). This is the same for all special characters that are set in the environment variable. However, the echo command shows the newline correctly.
If environment variable is empty and the same format is set directly in the code as default format here
rcutils/src/logging.c
Lines 87 to 88 in 025f78f
The behavior is correct and the newline is printed.
It looks like this issue comes from getting the environment variable.
rcutils/src/env.c
Line 78 in 025f78f
The return of this gives a char array which encodes the '\n' as '' and 'n' characters.
I used zsh, but it also happens with bash. System is Ubuntu 22.04 with ROS rolling.
The text was updated successfully, but these errors were encountered: