code: def capture_logs(caplog, monkeypatch):
      DATALAD_LOG_LEVEL = os.environ.get("DATALAD_LOG_LEVEL", None)
      if DATALAD_LOG_LEVEL is None:
          # very very silent.  Tests introspecting logs should use
          # swallow_logs(new_level=...)
          caplog.set_level(100, lgr.name)
          # And we should also set it within environ so underlying commands also
          # stay silent
          monkeypatch.setenv("DATALAD_LOG_LEVEL", "100")
  
file_path: datalad/datalad/conftest.py
imports: import logging
  import os
  import re
  from contextlib import ExitStack
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  from datalad.support.exceptions import CapturedException
  from datalad.utils import get_encoding_info, get_envvars_info, get_home_envvars
  from .None import cfg, ssh_manager
  from .log import lgr
label_desc: Use image node_id 2 for calling a global function with example usage: capture_logs(caplog, monkeypatch) without return types