Skip to content
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

Add option to set default log-level #38

Conversation

lukas-bednar
Copy link
Contributor

It could be useful when you want to reduce logs to be captured for whole pytest session.

@lukas-bednar lukas-bednar force-pushed the set_default_log_level branch from 9a8c5fc to 75a9aab Compare March 18, 2016 12:59
@abusalimov
Copy link
Collaborator

Thank you, and sorry this took that long for you to get feedback.
Does the name default_level imply that there is some other, "custom" level?

@lukas-bednar
Copy link
Contributor Author

@abusalimov you can always change log-level by using

with caplog.at_level(logging.ERROR):
    pass

but I don't mind to change name for that.

@abusalimov
Copy link
Collaborator

Ah, I see. This is a subject to change (#24) though.

Can we postpone this change a bit? I have some free time now, and I'm going to merge the stalled PRs to get them over with.

@lukas-bednar
Copy link
Contributor Author

No problem, take as much time you need (: ... I can rebase any time or I am also ok if you cover it in your change ... just let me know. Thanks

@abusalimov
Copy link
Collaborator

Sure! I appreciate your understanding :)

@dusktreader
Copy link

This would be very nice. However, it would also be nice to be able to set the default level inside a session-scoped pytest fixture. My flask app does a lot of logging in the setup that is hooked in session-wide fixtures, and I would love to be able to supress DEBUG output for that.

@pohmelie
Copy link

I wonder how this obvious feature is still missing!

@lukas-bednar
Copy link
Contributor Author

I think this feature is covered by options log_file_level & log_cli_level ?
@abusalimov could you please confirm ?

@abusalimov
Copy link
Collaborator

Sorry guys for making these stale, but just don't have enough spare time to sort these out, neither do @eisensheng or @The-Compiler, I'm afraid.

@lukas-bednar Can't tell for sure, it's better to check this in the source code.

@pohmelie
Copy link

@lukas-bednar
As far as I understand, log_cli_level affects only "live" logging (don't really get what it is). I see no difference in output logs on test fail between log_cli_level = ERROR and log_cli_level = DEBUG line in pytest.ini.

@lukas-bednar
Copy link
Contributor Author

since it was merged to pytest core, it is not relevant. closing ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants