Coverage for frappe_manager / logger / live_aware_handler.py: 100%
6 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-07-02 18:13 +0530
« prev ^ index » next coverage.py v7.13.5, created at 2026-07-02 18:13 +0530
1"""
2Live-aware logging handlers.
4Handlers that coordinate with Rich Live display to prevent output corruption.
5"""
7from rich.logging import RichHandler
10class LiveAwareRichHandler(RichHandler):
11 """
12 RichHandler that uses the same Console as the Live display.
14 Rich Console automatically handles coordination between Live displays
15 and regular print() calls, so no manual stop/start is needed.
17 Usage:
18 from frappe_manager.output_manager import get_global_output_handler
20 output = get_global_output_handler()
21 handler = LiveAwareRichHandler(
22 console=output.stderr,
23 )
24 logger.addHandler(handler)
25 """
27 def __init__(self, *args, live_display=None, output_lock=None, **kwargs):
28 super().__init__(*args, **kwargs)
29 self._live_display = live_display
30 self._output_lock = output_lock