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

Provide a mechanism to disable color output #611

Open
azeey opened this issue May 29, 2024 · 0 comments
Open

Provide a mechanism to disable color output #611

azeey opened this issue May 29, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@azeey
Copy link
Contributor

azeey commented May 29, 2024

Desired behavior

ANSI Color codes are usually not interpreted on our Jenkins consoles and end up making the output difficult to read.
Example from Jenkins:

213: �[m�[32m[Msg] �[m�[32mServing world names on [�[m�[32m/gazebo/worlds�[m�[32m]�[m�[32m
213: �[m�[32m[Msg] �[m�[32mResource path add service on [�[m�[32m/gazebo/resource_paths/add�[m�[32m].�[m�[32m
213: �[m�[32m[Msg] �[m�[32mResource path get service on [�[m�[32m/gazebo/resource_paths/get�[m�[32m].�[m�[32m
213: �[m�[32m[Msg] �[m�[32mResource path resolve service on [�[m�[32m/gazebo/resource_paths/resolve�[m�[32m].�[m�[32m
213: �[m�[32m[Msg] �[m�[32mResource paths published on [�[m�[32m/gazebo/resource_paths�[m�[32m].�[m�[32m
213: �[m�[32m[Msg] �[m�[32mServer control service on [�[m�[32m/server_control�[m�[32m].�[m�[32m

Thus, it would be nice to provide a mechanism to remove the color output when it's not desired.

Alternatives considered

Pipe test output through ansi2txt. However, I'm not sure if this tool is available in all of our platforms.

Implementation suggestion

Disable color output via an environment variable. For example, GZ_CONSOLE_COLOR=no or GZ_CONSOLE_COLOR=0. gtest has GTEST_COLOR used for similar effect.

You can set the GTEST_COLOR environment variable or the --gtest_color command line flag to yes, no, or auto (the default) to enable colors, disable colors, or let GoogleTest decide. When the value is auto, GoogleTest will use colors if and only if the output goes to a terminal and (on non-Windows platforms) the TERM environment variable is set to xterm or xterm-color.
-- https://google.github.io/googletest/advanced.html#colored-terminal-output

@azeey azeey added the enhancement New feature or request label May 29, 2024
@azeey azeey self-assigned this Jul 22, 2024
@azeey azeey moved this from Inbox to To do in Core development Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To do
Development

No branches or pull requests

1 participant