Version: v1.2.3 | Status: Active | Last Updated: March 2026
Foundation module providing centralized logging infrastructure for the Codomyrmex platform. Implements unified logging system with consistent formatting, configurable output destinations, and proper log level management.
- Self-contained logging system
- Clear interface boundaries
- Minimal external dependencies
- Composable logging components
- Consistent log formatting
- Unified configuration interface
- Standardized log levels
- Logical component organization
- Essential logging features only
- Minimal configuration surface
- Direct implementations
- Focus on core functionality
- Working logging system
- Practical configuration options
- Current best practices
- Reliable log delivery
- Comprehensive test coverage
- Configuration validation tests
- Output format verification
- Integration testing
- Clear API documentation
- Configuration examples
- Usage patterns
- Complete specifications
graph TD
subgraph sg_b332c3492d [Configuration]
EnvVars[Environment Variables]
ConfigFile[Configuration File]
end
subgraph sg_d155bc7da9 [Core System]
Setup[setup_logging()]
GetLogger[get_logger()]
LogContext[LogContext]
end
subgraph sg_e5d5a0063a [Output Layer]
Console[Console Handler]
File[File Handler]
JSON[JSONFormatter]
Text[Text Formatter]
end
EnvVars --> Setup
ConfigFile --> Setup
Setup --> GetLogger
GetLogger --> LogContext
Setup --> Console
Setup --> File
Console --> JSON
Console --> Text
File --> JSON
File --> Text
- Logging Setup: Initialize and configure logging system
- Logger Factory: Provide logger instances for modules
- Structured Logging: JSON format for machine-readable logs
- Text Logging: Human-readable text format
- Context Management: Correlation IDs and context injection
- Environment variable configuration
- Optional configuration file support
- Log level management
- Output destination control
- Type hints for all functions
- Clear error handling
- PEP 8 compliance
- Comprehensive docstrings
- ≥80% test coverage
- Configuration validation tests
- Output format verification
- Integration tests
- Complete API documentation
- Configuration examples
- Usage patterns
- Integration guides
setup_logging()- Initialize logging system with support for "TEXT" and "JSON" outputs.get_logger(name)- Get logger instance.JSONFormatter- Standardized JSON log formatter (legacyJsonFormatteralias removed).log_with_context()- Log with structured context.LogContext- Context manager for correlation IDs.
- Environment variables:
CODOMYRMEX_LOG_* - Optional configuration file
- Standard Python logging integration
- Call
setup_logging()at application start - Use
get_logger(__name__)in modules - Use
LogContextfor request tracing - Configure via environment variables
- All modules depend on this module
- Foundation layer service
- Minimal dependencies
- Stable API
- Human Documentation: README.md
- Technical Documentation: AGENTS.md
- Package Root: ../README.md
- Package SPEC: ../SPEC.md