code: def create_expected_log_file(log_path, tis):
      ti, _ = tis
      handler = FileTaskHandler(log_path)
  
      def create_expected_log_file(try_number):
          ti.try_number = try_number - 1
          handler.set_context(ti)
          handler.emit(
              logging.makeLogRecord({"msg": "Log for testing."})
          )
          handler.flush()
  
      yield create_expected_log_file
      # log_path fixture is used in log_app, so both have "module" scope. Because of that
      # log_path isn't deleted automatically by pytest between tests
      # We delete created log files manually to make sure tests do not reuse logs created by other tests
      for sub_path in log_path.iterdir():
          shutil.rmtree(sub_path)
  
imports: from __future__ import annotations
  import copy
  import logging
  import logging.config
  import pathlib
  import shutil
  import sys
  import tempfile
  import unittest.mock
  import urllib.parse
  import pytest
  from airflow import settings
  from airflow.config_templates.airflow_local_settings import DEFAULT_LOGGING_CONFIG
  from airflow.models import DagBag, DagRun
  from airflow.models.tasklog import LogTemplate
  from airflow.utils import timezone
  from airflow.utils.log.file_task_handler import FileTaskHandler
  from airflow.utils.log.logging_mixin import ExternalLoggingMixin
  from airflow.utils.session import create_session
  from airflow.utils.state import DagRunState, TaskInstanceState
  from airflow.utils.types import DagRunType
  from airflow.www.app import create_app
  from tests.test_utils.config import conf_vars
  from tests.test_utils.db import clear_db_dags, clear_db_runs
  from tests.test_utils.decorators import dont_initialize_flask_app_submodules
  from tests.test_utils.www import client_with_login
label_desc: Use image node_id 7 for calling a global function with example usage: create_expected_log_file(log_path, tis) without return types