question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Behavior changes based on presense of colorama

See original GitHub issue

Without colorama installed, the provided ColoredFormatter will always use colors, even when redirected to a file (ie. $ ./command.py 2> error_out.txt)

When colorama is installed, colorama detects a non-tty, and strips the colors.

Since colorlog provides a TTYColoredFormater that will strip colors for a non-tty, the above behavior seems not only inconsistent, but unintended. (ie. the user chooses stripping for non-tty by choosing TTYColoredFormater instead of ColoredFormatter, not by having or not having colorama installed.)

I therefore suggest that the colorama init should be called as: colorama.init(strip=False) or minimally some other option should be available to colorlog users to ‘force’ colors or prevent stripping.

I like my logs to have color even when redirected to files. Using ‘less -R’ let’s you still benefit from the colors when reviewing the output.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
borntypingcommented, Sep 2, 2020

Not sure what happened to the commit in #41. I don’t currently have a setup that I can build and publish colorlog with, so I won’t be able to fix this until next week.

0reactions
dimrozakiscommented, Oct 8, 2020

thanks @borntyping

Read more comments on GitHub >

github_iconTop Results From Across the Web

School Health Professional Grant Program (SHPG) | CDE
This grant program intends to: Increase the presence of licensed school health professionals to provide behavioral health education and intervention to students ...
Read more >
California Supply Chains Act - Kelly-Moore Paints
Our website implements the ARIA attributes (Accessible Rich Internet Applications) technique, alongside various behavioral changes, to ensure blind users ...
Read more >
iiPythonx/Custom-Presence: Simple application to ... - GitHub
Custom Presence is a python program that utilizes the Discord RPC to make a custom status. Built completely on pypresence as well as...
Read more >
Substantial Presence Test Worksheet (Non-Employee)
Request this form from student award recipients, international AP payment recipients and other non-employees to document U.S. tax residency ...
Read more >
django-admin and manage.py
Creates new migrations based on the changes detected to your models. Migrations, their relationship with apps and more are covered in depth in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found