left4me/l4d2host/logging.py

8 lines
269 B
Python

from typing import Callable
def emit_step(msg: str, on_stdout: Callable[[str], None] | None, passthrough: bool) -> None:
formatted = f"Step: {msg}"
if on_stdout is not None:
on_stdout(formatted)
if passthrough:
print(formatted, flush=True)