Skip to content

Logging Module

Async application logger with automatic caller detection and log cleanup.

Quick Start

from src.shared_services.logging.logger_factory import get_logger
from src.shared_services.logging.async_app_logger import LogLevel

logger = get_logger()
logger.set_log_level(LogLevel.DETAILED)

logger.info("Application started")
logger.warning("Something needs attention")
logger.error("Something went wrong")

How to properly import in classes

# Use this in class constructor
logger: Optional[AsyncAppLogger] = None
# Import in class like this
from src.shared_services.logging.logger_factory import get_logger
        self.logger = logger or get_logger()

Log Levels

Level File Output Console Output
NONE Disabled Disabled
BALANCED WARNING+ Disabled
DETAILED All levels INFO+ (colored)

Files

  • logger_factory.py - Singleton access (get_logger(), init_logger(), reset_logger())
  • async_app_logger.py - Logger implementation, formatters, utilities

Features

  • Queue-based async logging
  • Automatic caller detection (file, function, line)
  • Auto-cleanup of unimportant log files
  • Colored console output
  • Performance logging decorator