Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-25 Thread Vinay Sajip
Based on feedback here, I have a slightly revised proposal. Scott makes the point that if the file parameter passed in to showwarning is not None, the caller may be trying to extract output formatting. So, it's not enough just to assign warnings.showwarning = logging.showwarning, since access to th

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-23 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nick Coghlan wrote: > Antoine Pitrou wrote: >> Brett Cannon python.org> writes: >>> It is specifically there to be overridden (and as an aside, it was a >>> pain to support in the C port of warnings), so it really isn't >>> monkey-patching. =) >> Shou

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-23 Thread Nick Coghlan
Antoine Pitrou wrote: > Brett Cannon python.org> writes: >> It is specifically there to be overridden (and as an aside, it was a >> pain to support in the C port of warnings), so it really isn't >> monkey-patching. =) > > Should we coin a new word for this? Pretty-patching? When the module docs

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-23 Thread Antoine Pitrou
Brett Cannon python.org> writes: > > It is specifically there to be overridden (and as an aside, it was a > pain to support in the C port of warnings), so it really isn't > monkey-patching. =) Should we coin a new word for this? Pretty-patching? cheers Antoine. __

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-22 Thread Brett Cannon
On Sat, Nov 22, 2008 at 17:53, Vinay Sajip <[EMAIL PROTECTED]> wrote: > Sidnei da Silva enfoldsystems.com> writes: > >> I do have one suggestion for improvement: instead of requiring the >> person to do this monkey patching, add a new 'log' action to the >> warnings filter as described by PEP 230

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-22 Thread Vinay Sajip
Sidnei da Silva enfoldsystems.com> writes: > I do have one suggestion for improvement: instead of requiring the > person to do this monkey patching, add a new 'log' action to the > warnings filter as described by PEP 230 [1] (see: 'The Warnings > Filter' section). This way, changing the behavior

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-22 Thread Scott David Daniels
Scott David Daniels wrote: > > Match the new warning protocol exactly: > def showwarning(message, category, filename, lineno, > file=None, line=None): > ... > If the line is not None, use it (which will happen if you pass it > along to showwarning). > If

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-22 Thread Scott David Daniels
Vinay Sajip wrote: Brett Cannon has suggested [1] that the logging package should provide an implementation of warnings.showwarning which redirects to logging. Here are my first thoughts about how this might work: A new function, showwarning( message, category, filename, lineno[, file]) will be

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-22 Thread Sidnei da Silva
On Sat, Nov 22, 2008 at 9:12 AM, Vinay Sajip <[EMAIL PROTECTED]> wrote: > Brett Cannon has suggested [1] that the logging package should provide an > implementation of warnings.showwarning which redirects to logging. Here are my > first thoughts about how this might work: > > A new function, showwa

Re: [Python-Dev] Redirecting warnings.showwarning to logging

2008-11-22 Thread Brett Cannon
On Sat, Nov 22, 2008 at 03:12, Vinay Sajip <[EMAIL PROTECTED]> wrote: > Brett Cannon has suggested [1] that the logging package should provide an > implementation of warnings.showwarning which redirects to logging. Here are my > first thoughts about how this might work: > > A new function, showwarn

[Python-Dev] Redirecting warnings.showwarning to logging

2008-11-22 Thread Vinay Sajip
Brett Cannon has suggested [1] that the logging package should provide an implementation of warnings.showwarning which redirects to logging. Here are my first thoughts about how this might work: A new function, showwarning( message, category, filename, lineno[, file]) will be added to the logging