Skip to main content

get_logger()

Get a logger instance for the specified module. This function returns a configured logger that inherits from the root logger setup. The logger supports both Rich formatting for human-readable output and JSON formatting for machine processing, depending on environment configuration.
  • Parameters: name – The name of the module, typically name.
  • Returns: A configured Logger instance.

Example

>>> from openhands.sdk.logger import get_logger
>>> logger = get_logger(__name__)
>>> logger.info("This is an info message")
>>> logger.error("This is an error message")

rolling_log_view()

Temporarily attach a rolling view handler that renders the last N log lines.
  • Local TTY & not CI & not JSON: pretty, live-updating view (Rich.Live)
  • CI / non-TTY: plain line-by-line (no terminal control)
  • JSON mode: buffer only; on exit emit ONE large log record with the full snapshot.

setup_logging()

Configure the root logger. All child loggers inherit this setup.