Use colors in log only for terminals #53

Manually merged
BaumiCoder merged 1 commit from enhancement/no-colors-log-to-file into main 2026-06-05 12:38:59 +02:00
Owner

User perspective

You redirect stdout or stderr of ecformat into a file (e.g., with >>) or to another application (e.g., with |), you now get a nicer output. Before the changes from this Pull Request the control characters for coloring were included:

08:00:00 [INFO] check /path/to/repo/ecformat/src/main.rs

And now, you get a clean output in such cases, without losing the colors in the output on the terminal:

08:00:00 [INFO] check /path/to/repo/ecformat/src/main.rs

Developer perspective

The problem was that the simplelog crate does not check for terminal output with its Auto option (see issue). Therefore, ecformat has to check that for itself.

### User perspective You redirect stdout or stderr of ecformat into a file (e.g., with `>>`) or to another application (e.g., with `|`), you now get a nicer output. Before the changes from this Pull Request the control characters for coloring were included: ``` 08:00:00 [INFO] check /path/to/repo/ecformat/src/main.rs ``` And now, you get a clean output in such cases, without losing the colors in the output on the terminal: ``` 08:00:00 [INFO] check /path/to/repo/ecformat/src/main.rs ``` ### Developer perspective The problem was that the `simplelog` crate does not check for terminal output with its `Auto` option (see [issue](https://github.com/Drakulix/simplelog.rs/issues/108)). Therefore, ecformat has to check that for itself.
Use colors in log only for terminals
All checks were successful
/ changes (pull_request) Successful in 1m1s
/ lint_reuse (pull_request) Successful in 1m15s
/ lint_codespell (pull_request) Successful in 1m6s
/ lint_ecformat (pull_request) Successful in 9m21s
/ test (pull_request) Successful in 4m37s
/ lint_cargo_deny (advisories) (pull_request) Has been skipped
/ lint_cargo_deny (bans licenses sources) (pull_request) Has been skipped
/ lint_clippy (pull_request) Successful in 3m32s
/ lint_rustfmt (pull_request) Successful in 1m57s
/ lint_taplo (pull_request) Has been skipped
/ lint_yamllint (pull_request) Has been skipped
/ lint_cargo_udeps (pull_request) Successful in 22m56s
/ lint_docs_rs (pull_request) Successful in 4m29s
436942f251
BaumiCoder manually merged commit c7acc9c816 into main 2026-06-05 12:38:59 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BaumiCoder/ecformat!53
No description provided.