Skip to content

Allow control over log channels captured/displayed by CLI #9239

Open
@SeanDS

Description

@SeanDS

What's the problem this feature will solve?

My application emits a lot of logs. I'd like to view only a certain channel or channels when I specify e.g. --log-level=debug in the pytest CLI.

Describe the solution you'd like

It would be nice to be able to specify --log-channel=myapp.a.b one or more times to display only certain channels. The default could be --log-channel=* to display everything, but, if a non-default value is given, only the specified channels should be emitted to the console.

This would allow me to filter out log noise from irrelevant channels, especially at the debug level of my application, when trying to debug a specific failing test.

Alternative Solutions

I've not thought of any other solutions. I could add a log handler to my code directly, but that would defeat the purpose of configuring this on-demand via the CLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: loggingrelated to the logging builtin plugintype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions