A suggestion for an easy logger
Vinay Sajip
vinay_sajip at yahoo.co.uk
Sun May 8 06:26:18 EDT 2011
On May 8, 7:15 am, TheSaint <nob... at nowhere.net.no> wrote:
> OK, my analysis led me to the print() function, which would suffice for
> initial my purposes.
The logging HOWTO tells you when to use logging, warnings and print():
http://docs.python.org/howto/logging.html
> Meanwhile I reading the tutorials, but I couldn't get how to make a
> formatter to suppress or keep the LF(CR) at the end of the statement.
For Python 3.2 and later, it's the terminator attribute of the
StreamHandler. See:
http://plumberjack.blogspot.com/2010/10/streamhandlers-newline-terminator-now.html
Unfortunately, for earlier Python versions, you'd need to subclass and
override StreamHandler.emit() to get equivalent functionality :-(
Regards,
Vinay Sajip
More information about the Python-list
mailing list