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

RUST_LOG and RUST_LOG_STYLE support #1295

Closed
aathan opened this issue Apr 13, 2022 · 8 comments
Closed

RUST_LOG and RUST_LOG_STYLE support #1295

aathan opened this issue Apr 13, 2022 · 8 comments
Labels
C-cast Command: cast C-forge Command: forge T-debt Type: code debt

Comments

@aathan
Copy link
Contributor

aathan commented Apr 13, 2022

Component

Forge

Describe the feature you would like

RUST_LOG_STYLE=never seems to have no effect on forge, making it difficult to post logs without ansi codes. RUST_LOG=trace seems to have no effect on cast.

Additional context

No response

@aathan aathan added the T-feature Type: feature label Apr 13, 2022
@onbjerg
Copy link
Member

onbjerg commented Apr 13, 2022

There are no traces in Cast, I think. As for RUST_LOG_STYLE, I'm not sure why it doesn't work but it should

@onbjerg onbjerg added C-cast Command: cast C-forge Command: forge T-debt Type: code debt and removed T-feature Type: feature labels Apr 13, 2022
@aathan
Copy link
Contributor Author

aathan commented Apr 13, 2022

I had TERM=text and a couple of others trying to remember what terminfo name has no color, but I see in that link that "dumb" should work. Strangely, setting TERM=dumb also has no effect on colorization.

@mattsse
Copy link
Member

mattsse commented Apr 13, 2022

There are no traces in Cast, I think. As for RUST_LOG_STYLE, I'm not sure why it doesn't work but it should

this is env_logger but we log via https://github.com/tokio-rs/tracing and I'm not sure if their env filter supports that

@onbjerg
Copy link
Member

onbjerg commented Apr 13, 2022

Right, so we should likely use https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Layer.html#method.set_ansi - perhaps we can tie that in with some general color detection util that checks COLOR/terminfo etc?

@aathan
Copy link
Contributor Author

aathan commented Apr 15, 2022

Hey, just adding this here since it's a nit in the logging crate. If when you look at logging in general maybe you can emit a better error that at least mentions the RUST_LOG variable (or that the error is in regards to logging).

$ export RUST_LOG=
$ forge --version
ignoring ``: invalid filter directive
forge 0.2.0 (64087b5 2022-04-13T00:10:42.429318924+00:00)

@onbjerg
Copy link
Member

onbjerg commented Apr 15, 2022

That error is from the logging crate itself, so it's not something we can fix here :/

@aathan
Copy link
Contributor Author

aathan commented Apr 15, 2022

Fair enough, but since you are using the package, you could avoid this weird edge case by doing: "if(env(RUST_LOG)=="")deleteEnv("RUST_LOG");"

Happy to submit an issue to them point me to the crate's project.

@mattsse
Copy link
Member

mattsse commented Jun 8, 2022

disabling colored logs in now possible since #1450 via NO_COLOR=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast C-forge Command: forge T-debt Type: code debt
Projects
Archived in project
Development

No branches or pull requests

3 participants