Qix- / better-exceptions

Pretty and useful exceptions in Python, automatically.
MIT License
4.59k stars 203 forks source link

Logged exceptions shouldn't contain colour #87

Open majutsushi opened 5 years ago

majutsushi commented 5 years ago

Issuehunt badges

Currently if the output is to a terminal, then an exception that gets logged will also include the colour escape codes. This is not really ideal since they will just show up as raw escape codes in most editors, making the log harder to read. So it would be great if the logged exceptions could skip the colour-coding even if the current terminal supports colours. The output to the terminal itself should still be coloured of course. Thanks!


IssueHunt Summary ### Backers (Total: $50.00) - [issuehunt issuehunt](https://issuehunt.io/u/issuehunt) ($50.00) ### Submitted pull Requests - [#99 remove color from log files](https://issuehunt.io/r/Qix-/better-exceptions/pull/99) --- #### [Become a backer now!](https://issuehunt.io/r/Qix-/better-exceptions/issues/87) #### [Or submit a pull request to get the deposits!](https://issuehunt.io/r/Qix-/better-exceptions/issues/87) ### Tips - Checkout the [Issuehunt explorer](https://issuehunt.io/r/Qix-/better-exceptions/) to discover more funded issues. - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on IssueHunt to raise funds. --- IssueHunt has been backed by the following sponsors. [Become a sponsor](https://issuehunt.io/membership/members)
Qix- commented 5 years ago

I'm confused.

Currently if the output is to a terminal, then an exception that gets logged will also include the colour escape codes.

Yes, correct. That's how terminal colors work :p

This is not really ideal since they will just show up as raw escape codes in most editors, making the log harder to read.

Which editors? Where?

So it would be great if the logged exceptions could skip the colour-coding even if the current terminal supports colours.

Why would that be great? That just means no color.

The output to the terminal itself should still be coloured of course

I'm completely lost. What issue are you facing?

majutsushi commented 5 years ago

I mean that exception colours will also be present in log files that get written when using the logging module, for example when using logging.exception("oops"). These escape codes don't really belong in log files, only in direct terminal output, because editors that you would use to inspect log files are (generally) not terminals.

Qix- commented 5 years ago

Ohhh, you mean with the logging module. Okay, I agree. I'm not near a computer right now as I'm sick, but I'll try to reproduce in a while.

majutsushi commented 5 years ago

Sorry for being unclear earlier!

Qix- commented 5 years ago

No problem :)

jw-cpnet commented 5 years ago

Yes, I'm facing the same issue. Could you please consider adding an option to disable coloring?

issuehunt-oss[bot] commented 5 years ago

@issuehunt has funded $50.00 to this issue.


lokesh1729 commented 5 years ago

@Qix- @majutsushi any update on this??? as i understand we don't want the color ASCII characters to include while logging to files...

Qix- commented 5 years ago

@lokesh1729 As is with most OSS, if it is not updated on this issue, then there is no update. We don't secretly discuss/code outside of Github. Please don't spam my issues with comments asking for updates.

lokesh1729 commented 5 years ago

@Qix- i understand but my intention is not to spam but to contribute... i want to work on this issue, so "update" i mean is wanted to know if someone has already made a progress on it...

Qix- commented 5 years ago

Nope, nobody has made progress on it.

philippludwig commented 5 years ago

I can’t reproduce this. Whenever the logging module is involved, nothing of the output is colored. Maybe someone can provide a MCVE.

isaac-philip commented 4 years ago

Hello I c this issue still open? I can have a look