classification
Title: Second argument of LoggerAdapter.__init__ should default to None
Type: enhancement Stage: patch review
Components: Library (Lib) Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: arturoescaip, miss-islington, vinay.sajip
Priority: normal Keywords: patch

Created on 2020-05-24 18:02 by arturoescaip, last changed 2020-05-26 14:55 by miss-islington.

Pull Requests
URL Status Linked Edit
PR 20362 merged arturoescaip, 2020-05-24 18:10
Messages (2)
msg369815 - (view) Author: Arturo Escaip (arturoescaip) * Date: 2020-05-24 18:02
The 'extra' argument is not always used by custom logger adapters. There
example:

class IndentAdapter(logging.LoggerAdapter):
    def process(self, msg, kwargs):
        indent = kwargs.pop(indent, 1)
        return ' ' * indent + msg, kwargs

It is cleaner and friendlier to default the 'extra' argument to None
instead of either forcing the subclasses of LoggerAdapter to pass a None
value directly or to override the constructor.
msg369991 - (view) Author: miss-islington (miss-islington) Date: 2020-05-26 14:55
New changeset 8ad052464a4e0aef9a11663b80f187087b773592 by Arturo Escaip in branch 'master':
bpo-40756: Default second argument of LoggerAdapter.__init__ to None (GH-20362)
https://github.com/python/cpython/commit/8ad052464a4e0aef9a11663b80f187087b773592
History
Date User Action Args
2020-05-26 14:55:25miss-islingtonsetnosy: + miss-islington
messages: + msg369991
2020-05-25 18:19:20rhettingersetassignee: vinay.sajip

nosy: + vinay.sajip
2020-05-24 18:10:57arturoescaipsetkeywords: + patch
stage: patch review
pull_requests: + pull_request19626
2020-05-24 18:02:38arturoescaipcreate