Skip to content

Disable colors in logs#3433

Open
stepancheg wants to merge 1 commit intoyouki-dev:mainfrom
stepancheg:no-colors
Open

Disable colors in logs#3433
stepancheg wants to merge 1 commit intoyouki-dev:mainfrom
stepancheg:no-colors

Conversation

@stepancheg
Copy link

@stepancheg stepancheg commented Mar 1, 2026

Description

Youki is not meant to be used directly by humans, and colors in output makes reading logs in various tools (eg kubectl logs) unhelpful.

We can additionally do:

  • add an option or env var to enable colors
  • detect if stderr is tty and enable colors

Not sure it is worth the trouble. E.g. this is error message I currently have:

stderr=\u{1b}[31mERROR\u{1b}[0m \u{1b}[2mlibcontainer::process::init::process\u{1b}[0m\u{1b}[2m:\u{1b}[0m failed to drop capabilities \u{1b}[3merr\u{1b}[0m\u{1b}[2m=\u{1b}[0mSetCaps(CapsError(\"capset failure: Operation not permitted (os error 1)\"))\n\u{1b}[31mERROR\u{1b}[0m \u{1b}[2mlibcontainer::process::container_intermediate_process\u{1b}[0m\u{1b}[2m:\u{1b}[0m failed to initialize container process: failed syscall\n\u{1b}[31mERROR\u{1b}[0m \u{1b}[2mlibcontainer::process::container_main_process\u{1b}[0m\u{1b}[2m:\u{1b}[0m failed to wait for init ready: exec process failed with error error in executing process : failed syscall\n\u{1b}[31mERROR\u{1b}[0m \u{1b}[2mlibcontainer::container::builder_impl\u{1b}[0m\u{1b}[2m:\u{1b}[0m failed to run container process exec process failed with error error in executing process : failed syscall\n\u{1b}[31mERROR\u{1b}[0m \u{1b}[2myouki\u{1b}[0m\u{1b}[2m:\u{1b}[0m error in executing command: failed to create container: exec process failed with error error in executing process : failed syscall\nexec failed : failed to create container: exec process failed with error error in executing process : failed syscall

I will strip ANSI escapes from it, but again, I believe no colors by default is better.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test updates
  • CI/CD related changes
  • Other (please describe):

Testing

  • Added new unit tests
  • Added new integration tests
  • Ran existing test suite
  • Tested manually (please provide steps)
cargo run --bin=youki -- exec dfgdfg

colors before, no colors after.

Related Issues

Additional Context

Youki is not meant to be used directly by humans, and colors in output
makes reading logs in various tools (eg `kubectl logs`) unhelpful.

We can additionally do:
- add an option or env var to enable colors
- detect if stderr is tty and enable colors

Not sure it is worth the trouble.

Signed-off-by: Stepan Koltsov <stepan.koltsov@gmail.com>
@saku3 saku3 added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 1, 2026
Copy link
Member

@saku3 saku3 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! LGTM.

PTAL @youki-dev/youki-reviewers

@nayuta723
Copy link
Contributor

I will strip ANSI escapes from it, but again, I believe no colors by default is better.

I agree as well

We can additionally do:

  • add an option or env var to enable colors
  • detect if stderr is tty and enable colors

If we are going to address this in a separate PR, could you please create an issue and link it to the relevant parts of the code?

@stepancheg
Copy link
Author

#3435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants