Pytest: Support --log-cli

Created on 27 Dec 2019  路  4Comments  路  Source: pytest-dev/pytest

In the current pytest 5.3.2, --log-cli can only be configured via ini.

https://github.com/pytest-dev/pytest/blob/b532d15fe7543b7ee895cbbc101fcd0fe2543312/src/_pytest/logging.py#L209-L214

It will be great to support --log-cli as a command line option.

logging config proposal

Most helpful comment

Alternatively, you can also use --log-cli-level=LEVEL.

All 4 comments

The option override option is suppose to be used for that

Alternatively, you can also use --log-cli-level=LEVEL.

@jiasli this is intentional, because the -o allows you to change any ini option through the command line:

pytest -o log_cli=true

The original logging plugin contained ini option alternatives for every command-line option, and when it was introduced into pytest's core we kept all the original options/command-line arguments for backward compatibility.

Currently we try to avoid having duplicated command-line and configuration options, because the -o switch solves this nicely. The --log-cli was added after the logging plugin introduction to the core, so it follows this new approach.

Many thanks for the detailed explanation. 馃槂

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomalkalak picture tomalkalak  路  3Comments

wstrm picture wstrm  路  3Comments

RonnyPfannschmidt picture RonnyPfannschmidt  路  3Comments

jacquerie picture jacquerie  路  3Comments

nschloe picture nschloe  路  3Comments