https://github.com/apache/airflow/blob/main/airflow/cli/commands/task_command.py#L145
"""
    Redirect stdout to ti logger.
    Redirect stdout and stderr to the task instance log as INFO and WARNING
    level messages, respectively.
    If stdout already redirected (possible when task running with option
    `--local`), don't redirect again.
    """
    
    
    if not isinstance(sys.stdout, StreamLogWriter):
        info_writer = StreamLogWriter(ti.log, logging.INFO)
        warning_writer = StreamLogWriter(ti.log, logging.WARNING)
        with redirect_stdout(info_writer), redirect_stderr(warning_writer):
            yield
    else:
        yield
class TaskCommandMarker: