vibe.infrastructure.logging¶
Logging infrastructure for VIBE.
Provides structured logging configuration with different modes for development, testing, and production environments. Supports dual output (console + file) with different formatters and log levels.
CompactConsoleFormatter ¶
Structlog renderer that formats log records into a compact, columnar layout.
It replaces the default ConsoleRenderer.
__call__ ¶
__call__(logger: object, method_name: str, event_dict: EventDict) -> str
Consume the event_dict and return a single, formatted string.
This is the main processor method.
shorten_paths_processor ¶
shorten_paths_processor(logger: object, method_name: str, event_dict: EventDict) -> EventDict
Recursively replaces pathlib.Path objects in the event dict.
Paths under PROJECT_ROOT are converted to relative paths.
reorder_json_keys_processor ¶
reorder_json_keys_processor(logger: object, method_name: str, event_dict: EventDict) -> EventDict
Reorder the keys in the event_dict for JSON rendering to improve readability.
This is a structlog processor.
setup_logging ¶
setup_logging(is_devel: bool = False, log_file_path: Path | None = None, console_level: str = 'INFO', file_level: str = 'DEBUG') -> BoundLogger
Configure logging with support for dual output (console + file).
Use different formatters and log levels for each output.
Modes: 1. INTERACTIVE: Rich, colorful console output + JSON file output 2. PYTEST: Concise JSON for test runs (no file output) 3. PRODUCTION: JSON console + detailed JSON file output
| Parameters: |
|
|---|
| Returns: |
|
|---|
Environment Variables
VIBE_LOG_LEVEL: Override console log level (DEBUG, INFO, WARNING, ERROR) VIBE_QUIET_MODE: Set to "1" to suppress all logging TEST_LOGGING: Set to "true" to enable logging during pytest runs
suppress_cli_logging ¶
suppress_cli_logging() -> None
Suppress structured logging for CLI tools.
This is intended for vibe-dev and other CLI tools where debug/info logging to stdout interferes with tool output. Call this at the start of CLI main() functions.