A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/021597.html below:

[Python-Dev] Re: PEP 282 comments

[Python-Dev] Re: PEP 282 commentsTrent Mick trentm@ActiveState.com
Thu, 21 Mar 2002 19:37:47 -0800
So the decision is between the simpler:

    class Logger:
        def info(self, msg, *args): ...
            
        def exception(self, msg, *args):
            """Log sys.exc_info() at the ERROR level"""

and the slightly more complex:

    class Logger:
        def info(self, msg, *args, **kwargs):
            """Use kwargs["exc_info"] to log an exception at this level."""

        def exception(self, msg, *args, **kwargs):
            """Optionally pass in kwargs["exc_info"] otherwise sys.exc_info()
            is called to log exception information at the ERROR level."""


The argument for the latter is that is adds the capability of:
    (1) Logging an exception at a level other than ERROR (for which Jeremy
        maintains there is a string use case and for which Kevin Butler gives
        a simpler use case); and
    (2) Optionally explicitly passing in exc_info, that may differ from
        sys.exc_info().

    
The argument for the former is:
    (1) KISS and YAGNI
    (2) You should just be able to subclass Logger and add the functionality
        you want. This is only a string point if the given use cases are not
        at all common.
    (3) If you want to pass in exc_info other than sys.exc_info() then
        format it yourself or subclass Logger.

Thoughts?


Trent

-- 
Trent Mick
TrentM@ActiveState.com



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