code: def mock_handler():
      logger = logging.getLogger("airflow.task")
      old = logger.handlers[:]
      h = Mock()
      logger.handlers[:] = [h]
      yield h
      logger.handlers[:] = old
  
file_path: airflow/tests/utils/log/test_task_context_logger.py
imports: from __future__ import annotations
  import logging
  from unittest.mock import Mock
  import pytest
  from airflow.utils.log.task_context_logger import TaskContextLogger
  from tests.test_utils.config import conf_vars
label_desc: Use image node_id 1 for calling a global function with example usage: mock_handler() without return types