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

isatty not detected correctly #100

Closed
gergelyk opened this issue Oct 31, 2020 · 1 comment
Closed

isatty not detected correctly #100

gergelyk opened this issue Oct 31, 2020 · 1 comment

Comments

@gergelyk
Copy link

coloredlogs==14.0, under Linux:

# foo.py
import coloredlogs
import logging
logger = logging.getLogger(__name__)
coloredlogs.install()
logger.info('hello')
python foo.py 2> log # produces colored text (incorrectly)

Adding stream=sys.stderr fixes the problem.

# bar.py
import sys
import coloredlogs
import logging
logger = logging.getLogger(__name__)
coloredlogs.install(stream=sys.stderr)
logger.info('hello')
python barpy 2> log # produces monohrome text (correctly)
@xolox
Copy link
Owner

xolox commented Dec 10, 2020

Hi Grzegorz and thanks for the feedback. I've just published coloredlogs release 14.1 which fixes this issue.

@xolox xolox closed this as completed Dec 10, 2020
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