agentconnect.utils.logging_config module

Logging configuration for the AgentConnect framework.

This module provides a consistent logging setup across the framework, including colored output, module-specific log levels, and integration with LangGraph components.

class LogLevel(*values)

Bases: Enum

Enum for log levels.

DEBUG

Debug log level

INFO

Info log level

WARNING

Warning log level

ERROR

Error log level

DEBUG = 10
INFO = 20
WARNING = 30
ERROR = 40
class ColoredFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases: Formatter

Custom formatter with colors for log messages.

This formatter adds colors to log level names and logger names to improve readability in terminal output.

COLORS

Dictionary mapping log level names to color codes

COLORS = {'CRITICAL': '\x1b[31m\x1b[1m', 'DEBUG': '\x1b[36m', 'ERROR': '\x1b[31m', 'INFO': '\x1b[32m', 'WARNING': '\x1b[33m'}
format(record)

Format a log record with colors.

Parameters:

record – Log record to format

Returns:

Formatted log message with colors

setup_logging(level=LogLevel.INFO, module_levels=None)

Configure logging with colors and per-module settings.

Parameters:
  • level (LogLevel) – Default log level for all modules

  • module_levels (Optional[Dict[str, LogLevel]]) – Dict of module names and their specific log levels

Return type:

None

disable_all_logging()

Disable all logging output.

This is useful for examples and tests where logging output is not needed.

Return type:

None

get_module_levels_for_development()

Get recommended log levels for development.

Return type:

Dict[str, LogLevel]

Returns:

Dictionary of module names and their recommended log levels for development

setup_langgraph_logging(level=LogLevel.INFO)

Configure logging specifically for LangGraph components.

Parameters:

level (LogLevel) – Log level for LangGraph components

Return type:

None