Skip to content

Can't chain .opt() calls #192

@gazpachoking

Description

@gazpachoking

Calling opt more than once on a logger instance overrides all options that aren't specified to default, meaning you can't chain .opt() calls together.
For example in the following call, the color codes are ignored.

logger.opt(ansi=True).opt(depth=1).debug('<red>aoeu</>')

This doesn't make a lot of sense when done directly like this, but if you are using the recipe for adding custom loglevel methods, it calls .opt() to set the depth. The consequence of this is that you can no longer use .opt() directly from you code, since it will always be overridden by the depth call, including all of the options other than depth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementImprovement to an already existing featurewontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions