Skip to content

aea.helpers.logging

Logging helpers.

setup_logger

def setup_logger(name: str,
                 level: int = logging.INFO,
                 log_format: str = DEFAULT_FORMAT) -> Logger

Set up the logger.

get_logger

def get_logger(module_path: str, agent_name: str) -> Logger

Get the logger based on a module path and agent name.

AgentLoggerAdapter Objects

class AgentLoggerAdapter(LoggerAdapter)

This class is a logger adapter that prepends the agent name to log messages.

__init__

def __init__(logger: Logger, agent_name: str) -> None

Initialize the logger adapter.

Arguments:

  • logger: the logger.
  • agent_name: the agent name.

process

def process(
        msg: Any,
        kwargs: MutableMapping[str,
                               Any]) -> Tuple[Any, MutableMapping[str, Any]]

Prepend the agent name to every log message.

WithLogger Objects

class WithLogger()

Interface to endow subclasses with a logger.

__init__

def __init__(logger: Optional[Logger] = None,
             default_logger_name: str = "aea") -> None

Initialize the logger.

Arguments:

  • logger: the logger object.
  • default_logger_name: the default logger name, if a logger is not provided.

logger

@property
def logger() -> Logger

Get the component logger.

logger

@logger.setter
def logger(logger: Optional[Logger]) -> None

Set the logger.