Skip to content

Check isatty == false before coloring #54

@3Hren

Description

@3Hren

Hi!

I've found this library as an excellent solution to colorize the logging output. However, when the stdout/stderr is redirected somewhere else (./a.out > log.txt for example) the final output is still mangled with terminal special characters as an opposite expected behavior.

It's a common practice in Unix to check isatty function before trying to colorize, see man for more. Moreover the isatty function is associated with terminal as like as this crate, so it may be useful to add it.

I can implement this functionality if you agree. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions