1. memedough
  2. pytest-capturelog
  3. Issues
Issue #2 new

Control logging level from command line

Renato Alves
created an issue

It is often useful to control which logging level you want to use on a given test run outside the actual code.

It's also considered bad practice to have the actual code setting their own logging level, which if set globally makes it hard to control externally.

I couldn't find a way to achieve this using py.test and pytest-capturelog is the most logical place to have this option. Therefore I ask if an option --log-level can be added, accepting one of the standard logging levels: DEBUG, INFO, WARNING, ERROR, FATAL.


Comments (1)

  1. Tucker Beck

    This would be useful. For my own testing purposes, it would be nice to be able to set the log_level threshold for caplog globally in a session scoped fixture which the function scoped caplog fixture could then override

  2. Log in to comment