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

Monochrome logging with version 14.0 #81

Open
Arkangus opened this issue Feb 17, 2020 · 6 comments
Open

Monochrome logging with version 14.0 #81

Arkangus opened this issue Feb 17, 2020 · 6 comments

Comments

@Arkangus
Copy link

When running the following code, the output is:

import logging
import coloredlogs

logger = logging.getLogger(__name__)

coloredlogs.install(level='DEBUG')

logger.debug("debug")
logger.info("info")

With coloredlogs v12.0:
coloredlogsissue1
With coloredlogs v14.0:
coloredlogsissue2

I simply did a python -m pip install coloredlogs==14.0 between the two screenshots. Any idea why I lost the different colors?

@xolox
Copy link
Owner

xolox commented Feb 17, 2020

Hi @Arkangus and thanks for the feedback. The font in your screenshots looks like Consolas which would imply you're running Windows. Is that correct? And if so can you specify which version of Windows you are running? In case of Windows 10 please be precise in the exact version because that might turn out to be important.

@xolox
Copy link
Owner

xolox commented Feb 17, 2020

Yesterday evening I released coloredlogs 14.0 which is intended to enable native Windows ANSI support (clearly this is not working for you). This requires Windows 10.0.14393 or newer. The code is intended to fallback to Colorama on older Windows installations, it could also be this part isn't working.

@xolox
Copy link
Owner

xolox commented Feb 17, 2020

Also I can't help but notice that in your first screenshot the text info is highlighted in the same exact color of red that all text has in the second screenshot - it seems like the default text color is red. Did you customize the coloredlogs default styling?

@Arkangus
Copy link
Author

Hi,

Sorry for the missing information. Thank you for your library, it is quite nice!

I am using Windows 7 Pro.

I did not customize the coloredlogs default styling, as far as I know.

@xolox
Copy link
Owner

xolox commented Feb 18, 2020

Thanks for the follow up @Arkangus.

I tested the native Windows 10 support in a Windows 10 virtual machine provided for free by Microsoft as part of releasing the new feature, so I was pretty confident it would work well on Windows 10.

This is why it doesn't surprise me to hear that you're running an older Windows version. Unfortunately that Windows 10 virtual machine is the only Windows installation that I have access to for testing purposes, so I was unable to test my changes for compatibility with older Windows versions.

I did test the Colorama fall back despite running an up-to-date Windows 10 installation by manually editing the module humanfriendly/terminal.py to disable have_windows_native_ansi_support() (make it return False) however "unfortunately" both seem to work well in my environment:

coloredlogs-demo-win10

(the plain text at the top I added for debugging purposes, it's not part of official releases)

I'm going to have to think a bit more about how to diagnose / debug / resolve this issue...

@xolox
Copy link
Owner

xolox commented Feb 18, 2020

In an attempt to reproduce the issue without having access to a Windows 7 environment I tried (using the Windows 10 VM that I do have access to) to run the Python interpreter under the "Windows 7" as well as "Windows 8" compatibility modes however in both cases Colorama worked as intended (after disabling the check against the Windows 10 version by making have_windows_native_ansi_support() return False).

The only remaining approach that I can think of to continue diagnosing this issue further is to enhance the coloredlogs and/or humanfriendly packages with optional instrumentation that can be used to debug issues like these (e.g. using an environment variable).

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