Skip to content

log

log

Captain-hook logging: one per-session loguru file sink plus stderr warnings.

Modules log through loguru directly (from loguru import logger), attaching structured context with logger.bind(...). setup_logging() installs the sinks and a patcher that truncates long bound values so call sites never have to slice them by hand.

truncate_bound_values

truncate_bound_values(record: Record) -> None

Patcher: cap long string values bound via logger.bind(...).

make_format

make_format(template: str) -> Callable[[Record], str]

Build a loguru format function that appends bound context and the traceback.

setup_logging

setup_logging(transcript_path: str | None) -> None

Route captain-hook logs to a per-session loguru file sink plus stderr warnings.