Logging Module
mosaicolabs.logging_config.setup_sdk_logging ¶
Configures the global logging strategy for the Mosaico SDK.
This function initializes the 'mosaicolabs' logger namespace and provides two distinct output modes: a high-fidelity 'pretty' mode using the Rich library, and a standard stream mode for basic environments. It ensures that existing handlers are cleared to prevent duplicate log entries during re-initialization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
The logging threshold (e.g., "DEBUG", "INFO", "WARNING"). Defaults to "INFO". |
'INFO'
|
pretty
|
bool
|
If True and the 'rich' package is installed, enables enhanced terminal output with colors, timestamps, and formatted tracebacks. |
False
|
console
|
Optional[Console]
|
An optional Rich Console instance. If provided, the logger and any active UI (like progress bars) will synchronize to prevent screen flickering. Defaults to a new Console(stderr=True). |
None
|
Example
Notes
- When 'pretty' is enabled, the logger name is styled in 'dim white' to keep focus on the message content.
- Propagation is disabled (propagate=False) to prevent logs from bubbling up to the root logger and causing duplicate output in test runners like pytest.