Logging

The agentstr.logger module provides a pre-configured logger for use throughout the Agentstr SDK. It ensures that log messages are formatted consistently and can be easily controlled.

Overview

The logger is configured to output messages to the console with a standardized format that includes a timestamp, log level, and message.

Typical usage:

from agentstr.logger import get_logger

# Get the logger instance
logger = get_logger(__name__)

# Log messages at different levels
logger.debug("This is a debug message.")
logger.info("This is an info message.")
logger.warning("This is a warning message.")
logger.error("This is an error message.")

Reference

class agentstr.logger.Logger(name: str | None = None)[source]

Bases: object

Cache and configure logging.Logger instances by name.

__init__(name: str | None = None)[source]
get_logger() Logger[source]

Get the configured logger instance.

agentstr.logger.get_logger(name: str | None = None) Logger[source]

Get a logger instance with the given name.

Parameters:

name – The name of the logger. If None, uses the module’s name.

Returns:

A configured logging.Logger instance.