Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #94941

Re: Optimal solution for coloring logging output

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Optimal solution for coloring logging output
Date 2015-08-03 15:31 +0100
References <3mlD6d4jmMzFpW0@dovecot04.posteo.de>
Newsgroups comp.lang.python
Message-ID <mailman.1191.1438612295.3674.python-list@python.org> (permalink)

Show all headers | View raw


On 03/08/2015 10:13, c.buhtz@posteo.jp wrote:
> I don't want to ask how to do this because there are so many
> "solutions" about it.
> <http://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output>
>
> There are so much different and part of unpythontic solutions I can not
> decide myself. What do you (as real pythontics) think about that.
> Which of the solutions fit to concepts of Python and its logging
> package?
>
> Coloring means here not only the message itself. The (levelname) should
> be included in the coloring.
> For myself coloring the (levelname) would be enough to avoid to much
> color in the output.
>
> 1.
> The solution itself shouldn't care about plattform differences because
> there are still some packages which are able to offer
> plattform-independent console-coloring. Which would you prefere? ;)
>
> 2.
> Some solutions derive from StreamHandler or much more bad hacking the
> emit() function. I think both of them are not responsible for how the
> output should look or be presented.
>
> 3.
> How to present the output is IMO the responsibility of a Formater, isn't
> it? So I should derive from the Formater.
>
> What do you as Pythonics think of that? ;)
>

I'd go for this https://pypi.python.org/pypi/colorlog as recommended on 
a couple of answers on the stackoverflow thread you've referenced.

A slight aside, we're "Pythonistas", not "pythontics" or "Pythonics " :)

<take cover>
Should we subclass Pythonista into Pythonista2 and Pythonista3 so that 
people can show their preferred version?
</take cover>

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Optimal solution for coloring logging output Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-03 15:31 +0100

csiph-web