Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second argument of LoggerAdapter.__init__ should default to None #84933

Closed
arturoescaip mannequin opened this issue May 24, 2020 · 4 comments
Closed

Second argument of LoggerAdapter.__init__ should default to None #84933

arturoescaip mannequin opened this issue May 24, 2020 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@arturoescaip
Copy link
Mannequin

arturoescaip mannequin commented May 24, 2020

BPO 40756
Nosy @vsajip, @miss-islington, @iritkatriel, @arturoescaip
PRs
  • bpo-40756: Default second argument of LoggerAdapter.__init__ to None #20362
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/vsajip'
    closed_at = <Date 2020-08-17.22:50:12.180>
    created_at = <Date 2020-05-24.18:02:38.273>
    labels = ['type-feature', 'library']
    title = 'Second argument of LoggerAdapter.__init__ should default to None'
    updated_at = <Date 2020-08-17.22:50:37.993>
    user = 'https://github.com/arturoescaip'

    bugs.python.org fields:

    activity = <Date 2020-08-17.22:50:37.993>
    actor = 'arturoescaip'
    assignee = 'vinay.sajip'
    closed = True
    closed_date = <Date 2020-08-17.22:50:12.180>
    closer = 'arturoescaip'
    components = ['Library (Lib)']
    creation = <Date 2020-05-24.18:02:38.273>
    creator = 'arturoescaip'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40756
    keywords = ['patch']
    message_count = 4.0
    messages = ['369815', '369991', '375564', '375575']
    nosy_count = 4.0
    nosy_names = ['vinay.sajip', 'miss-islington', 'iritkatriel', 'arturoescaip']
    pr_nums = ['20362']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue40756'
    versions = []

    @arturoescaip
    Copy link
    Mannequin Author

    arturoescaip mannequin commented May 24, 2020

    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.

    @arturoescaip arturoescaip mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 24, 2020
    @miss-islington
    Copy link
    Contributor

    New changeset 8ad0524 by Arturo Escaip in branch 'master':
    bpo-40756: Default second argument of LoggerAdapter.__init__ to None (GH-20362)
    8ad0524

    @iritkatriel
    Copy link
    Member

    looks like this can be closed now?

    @arturoescaip arturoescaip mannequin closed this as completed Aug 17, 2020
    @arturoescaip arturoescaip mannequin closed this as completed Aug 17, 2020
    @arturoescaip
    Copy link
    Mannequin Author

    arturoescaip mannequin commented Aug 17, 2020

    Done.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants