Skip to content

Logging API Reference

Unified logging configuration for AGB SDK using loguru.

This module provides a centralized logging configuration with beautiful formatting and structured output for different log levels.

AGBLogger

python
class AGBLogger()

AGB SDK Logger with beautiful formatting.

setup

python
@classmethod
def setup(cls,
          level: str = "INFO",
          log_file: Optional[Union[str, Path]] = None,
          enable_console: bool = True,
          enable_file: bool = True,
          rotation: str = "10 MB",
          retention: str = "30 days") -> None

Setup the logger with custom configuration.

Arguments:

  • level str - Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL). Defaults to "INFO".
  • log_file Optional[Union[str, Path]] - Path to log file (optional). Defaults to None.
  • enable_console bool - Whether to enable console logging. Defaults to True.
  • enable_file bool - Whether to enable file logging. Defaults to True.
  • rotation str - Log file rotation size. Defaults to "10 MB".
  • retention str - Log file retention period. Defaults to "30 days".

get_logger

python
@classmethod
def get_logger(cls, name: Optional[str] = None)

Get a logger instance.

Arguments:

  • name Optional[str] - Logger name (optional). Defaults to None.

Returns:

logger: Configured logger instance.

set_level

python
@classmethod
def set_level(cls, level: str) -> None

Set the logging level.

Arguments:

  • level str - New log level.

log

python
log = AGBLogger.get_logger("agb")

get_logger

python
def get_logger(name: str)

Convenience function to get a named logger.

Arguments:

  • name str - Logger name.

Returns:

logger: Named logger instance.

log_api_call

python
def log_api_call(api_name: str, request_data: str = "") -> None

Log API call with consistent formatting.

Arguments:

  • api_name str - Name of the API being called.
  • request_data str - Data sent with the request. Defaults to "".

log_api_response

python
def log_api_response(response_data: str, success: bool = True) -> None

Log API response with consistent formatting.

Arguments:

  • response_data str - Data received in the response.
  • success bool - Whether the API call was successful. Defaults to True.

log_operation_start

python
def log_operation_start(operation: str, details: str = "") -> None

Log the start of an operation.

Arguments:

  • operation str - Name of the operation.
  • details str - Additional details about the operation. Defaults to "".

log_operation_success

python
def log_operation_success(operation: str, result: str = "") -> None

Log successful operation completion.

Arguments:

  • operation str - Name of the operation.
  • result str - Result details of the operation. Defaults to "".

log_operation_error

python
def log_operation_error(operation: str, error: str) -> None

Log operation error.

Arguments:

  • operation str - Name of the operation.
  • error str - Error message.

log_warning

python
def log_warning(message: str, details: str = "") -> None

Log warning with consistent formatting.

Arguments:

  • message str - Warning message.
  • details str - Additional details about the warning. Defaults to "".

Documentation generated automatically from source code using pydoc-markdown.