class_docstr: Custom implementation of StreamHandler, a class which writes logging records for Airflow.
docstr: Accept the run-time context (i.e. the current task) and configure the formatter accordingly.
  
  :param ti:
  :return:
code: def set_context(self, ti) -> None:
      """
      Accept the run-time context (i.e. the current task) and configure the formatter accordingly.
  
      :param ti:
      :return:
      """
      if ti.raw or self.formatter is None:
          return
      prefix = conf.get("logging", "task_log_prefix_template")
  
      if prefix:
          _, self.prefix_jinja_template = parse_template_string(prefix)
          rendered_prefix = self._render_prefix(ti)
      else:
          rendered_prefix = ""
      formatter = logging.Formatter(
          f"{rendered_prefix}:{self.formatter._fmt}"
      )
      self.setFormatter(formatter)
      self.setLevel(self.level)
  
file_path: airflow/airflow/utils/log/task_handler_with_custom_formatter.py
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING
  from airflow.configuration import conf
  from airflow.utils.helpers import parse_template_string, render_template_to_string
label_desc: Use image node_id 1 for calling the TaskHandlerWithCustomFormatter obj's underlying member method code with example usage: obj.set_context(ti) without return types