[Python-Dev] Re: PEP 282 comments

Trent Mick trentm@ActiveState.com
2002年3月20日 15:57:06 -0800


[Vinay Sajip wrote]
> > ZEO is a component that lets clients on remote machines
> > access a ZODB storage using a custon Python RMI. (The
> > details aren't exactly important, except that it's a
> > concrete example.)
> Point taken. In my current implementation, there is a generalized logging
> method in class Logger:
>> def log(self, level, msg, *args):
>> I propose to add an additional method:
>> def logException(self, level, exc_info, msg, *args)

No need to pass in the exc_info if you are already specifying that an
exception is being logged via log*Exception*.
How about this (just an idea):
 def info(self, msgOrException, *args):
 if isinstance(msgOrException, Exception):
 # format the exception and 
 msg, args = args[0], args[1:]
 else:
 # treat it like before
 try:
 # ...
 except Exception, ex:
 log.info(ex, "Eeeeek!")
Trent
-- 
Trent Mick
TrentM@ActiveState.com

AltStyle によって変換されたページ (->オリジナル) /