Skip to content

Add --log-cli option #7680

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

Closed
GergelyKalmar opened this issue Aug 24, 2020 · 5 comments
Closed

Add --log-cli option #7680

GergelyKalmar opened this issue Aug 24, 2020 · 5 comments
Assignees
Labels
plugin: logging related to the logging builtin plugin topic: config related to config handling, argument parsing and config file type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature

Comments

@GergelyKalmar
Copy link
Contributor

It is a bit tiresome to use -o log_cli=true to enable live logging – I've found that this is one of the options I use most often while TDD-ing. Adding this option to the config file is not really nice either because if one accidentally commits it then the automated tests are going to start doing live logging too, which is most likely not what one wants.

Would it be therefore possible to add a --log-cli option to pytest? Having a shorter flag like -g as well would be even more awesome (unfortunately -l is already used by a flag I rarely if ever need).

Thank you!

@Zac-HD Zac-HD added plugin: logging related to the logging builtin plugin topic: config related to config handling, argument parsing and config file type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature labels Aug 25, 2020
@symonk
Copy link
Member

symonk commented Oct 7, 2020

Hi @GergelyKalmar, the following should exhibit the same behaviour on its own:

--log-cli-level=LEVEL

I will add an explicit CLI option for it, makes sense to me to have it slightly more shorthand

@symonk symonk self-assigned this Oct 7, 2020
@GergelyKalmar
Copy link
Contributor Author

Makes sense! In the meantime I ended up creating a small plugin that adds a --live option, which in turn enables both -s and log_cli at the same time. This way I pretty much see the same behavior as I would if I were just running a program outside of a test suite. It even sets -n to 0 with pytest-xdist to make sure things don't run in parallel in live mode, which is nice.

@symonk
Copy link
Member

symonk commented Oct 27, 2020

@nicoddemus / @bluetech / @RonnyPfannschmidt what is the process of where we decide something is viable and should be added? I want to avoid spending time doing pieces of work only to realise at PR time its not a viable option for the pytest core.

@nicoddemus
Copy link
Member

@symonk there's no formal process I'm afraid, often what we do is to ask specifically for buy in from some people.

Personally on this I'm -0.5, because -o log_cli=true and --log-cli are not that far apart IMHO, but again I don't really use logging much so I wouldn't mind adding this if people who use logging a lot find the difference a game changer for them (note that -o log_cli=1 also works).

@Zac-HD
Copy link
Member

Zac-HD commented Jul 6, 2024

Closing this per #12465 (comment)

@Zac-HD Zac-HD closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: logging related to the logging builtin plugin topic: config related to config handling, argument parsing and config file type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Projects
None yet
Development

No branches or pull requests

4 participants