I asked this question for python 2 here , but again ran into a problem when the answer no longer worked on Python 3.2.3.
Here is the code that runs on Python 2.7.3:
import logging
Running using Python 2.7.3:
tcsh-16: python demo_python_2.7.3.py DEBUG: This is a DEBUG-level message 20: This is an INFO-level message
As far as I can tell, conversion to Python3 only requires a small mod for CustomConsoleFormatter. init ():
def __init__(self): super().__init__(fmt="%(levelno)d: %(msg)s", datefmt=None, style='%')
In Python 3.2.3:
tcsh-26: python3 demo_python_3.2.3.py 10: This is a DEBUG-level message 20: This is an INFO-level message
As you can see, my desire to replace β10β with βDEBUGβ is in the way.
I tried digging into the Python3 source, and it looks like the PercentStyle instance is clobbering self._fmt after I, well, clog it myself.
My chops logs stop, you can hardly get around this wrinkle.
Can someone recommend another way or maybe indicate what I'm missing?
JS. Feb 13 '13 at 1:25 2013-02-13 01:25
source share