code: def test_collection_logging_to_file(pytester: Pytester) -> None:
      log_file = str(pytester.path.joinpath("pytest.log"))
  
      pytester.makeini(
          """
          [pytest]
          log_file={}
          log_file_level = INFO
          """.format(
              log_file
          )
      )
  
      pytester.makepyfile(
          """
          import logging
  
          logging.getLogger().info("Normal message")
  
          def test_simple():
              logging.getLogger().debug("debug message in test_simple")
              logging.getLogger().info("info message in test_simple")
      """
      )
  
      result = pytester.runpytest()
  
      result.stdout.no_fnmatch_line("*--- live log collection ---*")
  
      assert result.ret == 0
      assert os.path.isfile(log_file)
      with open(log_file, encoding="utf-8") as rfh:
          contents = rfh.read()
          assert "Normal message" in contents
          assert "debug message in test_simple" not in contents
          assert "info message in test_simple" in contents
  
imports: import io
  import os
  import re
  from typing import cast
  import pytest
  from _pytest.capture import CaptureManager
  from _pytest.config import ExitCode
  from _pytest.fixtures import FixtureRequest
  from _pytest.pytester import Pytester
  from _pytest.terminal import TerminalReporter
label_desc: Use image node_id 25 for calling a global function with example usage: test_collection_logging_to_file(pytester) without return types