Optimal solution for coloring logging output
breamoreboy at yahoo.co.uk
Mon Aug 3 16:31:11 CEST 2015
On 03/08/2015 10:13, c.buhtz at posteo.jp wrote:
> I don't want to ask how to do this because there are so many
> "solutions" about it.
> 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
> 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.
> 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? ;)
> 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.
> 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 " :)
Should we subclass Pythonista into Pythonista2 and Pythonista3 so that
people can show their preferred version?
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
More information about the Python-list