class_docstr: Provides access and control of log capturing.
class_docstr_tok: ["Provides","access","and","control","of","log","capturing","."]
docstr: Sets the level for capturing of logs. The level will be restored to its previous value at the end of
  the test.
  
  :param int level: the logger to level.
  :param str logger: the logger to update the level. If not given, the root logger level is updated.
  
  .. versionchanged:: 3.4
      The levels of the loggers changed by this function will be restored to their initial values at the
      end of the test.
docstr_tok: ["Sets","the","level","for","capturing","of","logs",".","The","level","will","be","restored","to","its","previous","value","at","the","end","of","the","test",".",":","param","int","level",":","the","logger","to","level",".",":","param","str","logger",":","the","logger","to","update","the","level",".","If","not","given",",","the","root","logger","level","is","updated",".","..","versionchanged",":",":","3.4","The","levels","of","the","loggers","changed","by","this","function","will","be","restored","to","their","initial","values","at","the","end","of","the","test","."]
code: def set_level(self, level, logger=None):
      """Sets the level for capturing of logs. The level will be restored to its previous value at the end of
      the test.
  
      :param int level: the logger to level.
      :param str logger: the logger to update the level. If not given, the root logger level is updated.
  
      .. versionchanged:: 3.4
          The levels of the loggers changed by this function will be restored to their initial values at the
          end of the test.
      """
      logger_name = logger
      logger = logging.getLogger(logger_name)
      # save the original log-level to restore it during teardown
      self._initial_log_levels.setdefault(logger_name, logger.level)
      logger.setLevel(level)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import re
  from contextlib import contextmanager
  import py
  import six
  import pytest
  from _pytest.compat import dummy_context_manager
  from _pytest.config import create_terminal_writer
  from _pytest.pathlib import Path
label_desc: Use image node_id 10 for calling the LogCaptureFixture obj's underlying member method code with example usage: obj.set_level(level, logger) without return types