Closed andbleo closed 11 months ago
I don't think this is expected. I can't see any reason this would happen - the colors
and stderr
features are pretty separate. Do you get coloured logs if you enable colors
and stderr
without redirecting any output?
I can see a potential bug in the code where this might happen on Windows specifically: https://github.com/borntyping/rust-simple_logger/blob/main/src/lib.rs#L463
I do get colors when I don't redirect stdout. Perhaps it is a bug in the colored dependency for non-windows platforms?
Ah: this does look like it may be a bug in colored
, which checks STDOUT to decide if it should show colours.
https://docs.rs/colored/latest/src/colored/control.rs.html#108
I will open an issue with colored and link to this one.
Closing this as it looks like it's currently intended behavior on coloured
's part.
When I have the stderr and colors features enabled and redirect just stdout, the colors in my stderr logs are no longer there. If I remove the stderr feature and try redirecting stderr, my stdout logs do have color. Is this expected behavior?
This is on macOS and happens in both iTerm2 and the vs code terminal.
Here is how I pull in simple_logger in Cargo.toml:
simple_logger = { version = "4.0.0", features = ["stderr"] }