On Sat, Nov 22, 2008 at 03:12, Vinay Sajip <vinay_sajip at yahoo.co.uk> 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 added to the logging package. To redirect all warnings to the logging system, > it will only be necessary to do the following: > > warnings.showwarning = logging.showwarning > > The implementation of logging.showwarning will call formatwarning(message, > category, filename, lineno) and will log the resulting string to a warnings > logger named "stdlib.warnings" (or perhaps "std.warnings") with level > logging.WARNING. The optional file argument to logging.showwarning is only for > signature compatibility with warnings.showwarning and will be ignored; in order > to configure logging of warnings to any particular destination, the logging > configuration will need to add appropriate handlers to the warnings logger. The > precise format of the logging message will be determined by the logging > configuration in effect, i.e. any formatters configured for the handlers > attached to the logger. > > Does this sound like a reasonable approach? Can someone please suggest any > improvements, or let me know if I've missed anything? > Basically what I had in mind, so it sounds reasonable to me. -Brett
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4