1
Modules Logger
Logan Fick edited this page 2026-02-08 11:10:13 -05:00

Modules - Logger

Every handler context provides a pre-configured logger via ctx.logger.

Using the Logger

from owlbot.api import on_command, CommandContext

@on_command("ping")
async def ping(ctx: CommandContext) -> None:
    ctx.logger.info("Ping command invoked")
    ctx.logger.debug("Processing ping for %s", ctx.user.display_name)
    await ctx.owncast_client.send_message("pong")

Logger Naming

Module loggers are named owlbot.modules.<module_name>, matching the hierarchical scheme described on the Logging page. ctx.logger is equivalent to logging.getLogger("owlbot.modules.<module_name>").

Log Levels

ctx.logger respects the global log level set by the -v flag, so ctx.logger.debug(...) calls only appear when running in verbose mode.