[Python-Dev] Re: PEP 282 comments (Jeremy Hylton) (original) (raw)

Kevin Butler kbutler@campuspipeline.com
Wed, 20 Mar 2002 18:59:24 -0700


From: "Jeremy Hylton" <jeremy@zope.com>

I really like the shorthands for log levels, e.g. logger.debug() instead of logger.log(DEBUG, ...). So I'd be disappointed if I couldn't use it when I want to log an exception.

+1

Conceptually, I'm logging a debug message (or error message, or warning), and want to include exception information. The optional named argument allows all the levels to provide exception logging easily and consistently, without cluttering the interface with lots of "levelEx" methods.

I'd probably spell it: class Logger: def debug( msg, exc=None ): ...

log.debug( msg, exc=sys.exc_info() )

Or possibly: log.debug( msg, exc=1 )

to have the logger call sys.exc_info()

kb

PS. As this is my first post to Python-dev, here's the ObBriefIntro:

I've been using Python for several years, I actually first played with Python because of a web search hit on the "soundex" module, of all things (soundex was disappointing, Python was not...). I rapidly moved on to doing CORBA, Java, GUI, WWW, and RDB work with Python, and now tend to use Jython extensively.