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

Expose a property to disable color logging #299

Merged
merged 1 commit into from
Feb 2, 2018

Conversation

mafredri
Copy link
Contributor

@mafredri mafredri commented Feb 2, 2018

The TTY check assumes we are logging to stdout, however, since the logger can be changed (e.g. to a file) this check is insufficient.

To work around this issue, we expose NoColor on the DefaultLogFormatter in a backwards-compatible manner.

Fixes #290.

Ideally this could in the future be refactored and expose e.g. Logger / ColorLogger, giving more control to the user and perhaps avoiding the TTY check altogether.

The TTY check assumes we are logging to stdout, however, since the
logger can be changed (e.g. to a file) this check is insufficient.

To work around this issue, we expose NoColor on the DefaultLogFormatter
in a backwards-compatible manner.

Fixes go-chi#290.
@pkieltyka pkieltyka merged commit cd4fa09 into go-chi:master Feb 2, 2018
@mafredri mafredri deleted the log-color-fix branch February 2, 2018 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants