Skip to content

Documentation for caplog set_level() should make it clearer it's a threshold #9146

@MetRonnie

Description

@MetRonnie

What's the problem this feature will solve?

The documentation for caplog.set_level() says

Set the level of a logger for the duration of a test.

This does not make it clear that it's setting the threshold level for capturing logging.

Describe the solution you'd like

The Python logging documentation makes this clear for logging.setLevel():

Sets the threshold for this logger to level. Logging messages which are less severe than level will be ignored; ...

caplog.set_level() ought to do the same.

Additional context

The only reason I know it's a threshold is because I tried running pytest -rA with different levels set in caplog and the output contained messages at that level and above

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributortype: docsdocumentation improvement, missing or needing clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions