code: def test_with_statement_at_level(
      caplog: pytest.LogCaptureFixture,
  ) -> None:
      with caplog.at_level(logging.INFO):
          logger.debug("handler DEBUG level")
          logger.info("handler INFO level")
  
          with caplog.at_level(logging.CRITICAL, logger=sublogger.name):
              sublogger.warning("logger WARNING level")
              sublogger.critical("logger CRITICAL level")
  
      assert "DEBUG" not in caplog.text
      assert "INFO" in caplog.text
      assert "WARNING" not in caplog.text
      assert "CRITICAL" in caplog.text
  
imports: import logging
  from typing import Iterator
  import pytest
  from _pytest.logging import caplog_records_key
  from _pytest.pytester import Pytester
label_desc: Use image node_id 8 for calling a global function with example usage: test_with_statement_at_level(caplog) without return types