diff --git a/README.rst b/README.rst index e192bc0..ac42690 100644 --- a/README.rst +++ b/README.rst @@ -87,7 +87,7 @@ Inside tests it is possible to change the log level for the captured log messages. This is supported by the ``caplog`` funcarg:: def test_foo(caplog): - caplog.setLevel(logging.INFO) + caplog.set_level(logging.INFO) pass By default the level is set on the handler used to catch the log @@ -95,21 +95,21 @@ messages, however as a convenience it is also possible to set the log level of any logger:: def test_foo(caplog): - caplog.setLevel(logging.CRITICAL, logger='root.baz') + caplog.set_level(logging.CRITICAL, logger='root.baz') pass It is also possible to use a context manager to temporarily change the log level:: def test_bar(caplog): - with caplog.atLevel(logging.INFO): + with caplog.at_level(logging.INFO): pass Again, by default the level of the handler is affected but the level of any logger can be changed instead with:: def test_bar(caplog): - with caplog.atLevel(logging.CRITICAL, logger='root.baz'): + with caplog.at_level(logging.CRITICAL, logger='root.baz'): pass Lastly all the logs sent to the logger during the test run are made