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

Honor NO_COLOR environment variable #88

Closed
PhilippWendler opened this issue Apr 7, 2020 · 1 comment
Closed

Honor NO_COLOR environment variable #88

PhilippWendler opened this issue Apr 7, 2020 · 1 comment

Comments

@PhilippWendler
Copy link

A quasi standard has been established that programs should not color their output if the NO_COLOR environment variable is set (cf. https://no-color.org/) and many programs and logging libraries already support that. So I suggest for coloredlogs to adopt this as well, i.e., silently avoid coloring the output just like it does if it detects that the output does not go to a console.

Of course, as a developer using coloredlogs I could skip importing coloredlogs by myself if the environment variable is set, but I guess it would be nice for users if the library would implement this itself, such that all projects using it would benefit from it.

@xolox xolox closed this as completed in 857f2b2 Dec 10, 2020
@xolox
Copy link
Owner

xolox commented Dec 10, 2020

Hi Philipp and thanks for the suggestion. I've just published coloredlogs release 14.2 which adds support for $NO_COLOR.

bors bot added a commit to duckinator/bork that referenced this issue Dec 10, 2020
220: Update coloredlogs to 15.0 r=duckinator a=pyup-bot


This PR updates [coloredlogs](https://pypi.org/project/coloredlogs) from **14.0** to **15.0**.



<details>
  <summary>Changelog</summary>
  
  
   ### 15.0
   ```
   ----------------------------

Don&#39;t enable system logging on MacOS and Windows anymore.

This is backwards incompatible (which is why I&#39;m bumping the major version
number) however the old behavior has been reported to be rather problematic
(see :func:`~coloredlogs.syslog.is_syslog_supported()` for details) so this
seems like the best choice.

.. _Release 15.0: xolox/python-coloredlogs@14.2...15.0
   ```
   
  
  
   ### 14.3
   ```
   ----------------------------

Merged pull request `89`_ which enhances :func:`coloredlogs.install()` to
preserve the filters on handlers that are replaced by :pypi:`coloredlogs`.

.. _Release 14.3: xolox/python-coloredlogs@14.2...14.3
.. _89: xolox/python-coloredlogs#89
   ```
   
  
  
   ### 14.2
   ```
   ----------------------------

Honor the ``$NO_COLOR`` environment variable as suggested in issue `88`_.

.. _Release 14.2: xolox/python-coloredlogs@14.1...14.2
.. _88: xolox/python-coloredlogs#88
   ```
   
  
  
   ### 14.1
   ```
   ----------------------------

**Bug fixes:**

- Don&#39;t allow interactive terminal detection to disable colored text when
  colored text is being forced by the caller (reported in issue `84`_).

- Automatically disable colored text when logging output is being redirected to
  a file in such a way that it actually works 😬 (reported in issue `100`_).

**Other changes:**

- Start testing on PyPy 3 (because why not?)

.. _Release 14.1: xolox/python-coloredlogs@14.0...14.1
.. _84: xolox/python-coloredlogs#84
.. _100: xolox/python-coloredlogs#100
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/coloredlogs
  - Changelog: https://pyup.io/changelogs/coloredlogs/
  - Docs: https://coloredlogs.readthedocs.io
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
Co-authored-by: Ellen Marie Dash <me@duckie.co>
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

No branches or pull requests

2 participants