|
22 | 22 | import haven_vlm_config as config |
23 | 23 |
|
24 | 24 | # Configure logging |
25 | | -logging.basicConfig(level=logging.CRITICAL) |
| 25 | +logging.basicConfig( |
| 26 | + level=logging.WARNING, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" |
| 27 | +) |
26 | 28 | logger = logging.getLogger(__name__) |
27 | 29 |
|
28 | 30 | @dataclass |
@@ -87,12 +89,29 @@ def __init__(self): |
87 | 89 | self.engine_config: Optional[EngineConfig] = None |
88 | 90 | self._initialized = False |
89 | 91 |
|
| 92 | + def _configure_logging(self) -> None: |
| 93 | + """Configure logging levels based on plugin config.""" |
| 94 | + vlm_config = config.config.vlm_engine_config |
| 95 | + trace_enabled = vlm_config.get("trace_logging", False) |
| 96 | + |
| 97 | + if trace_enabled: |
| 98 | + logging.basicConfig( |
| 99 | + level=logging.DEBUG, |
| 100 | + format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", |
| 101 | + ) |
| 102 | + logging.getLogger("logger").setLevel(logging.DEBUG) |
| 103 | + logging.getLogger("multiplexer_llm").setLevel(logging.DEBUG) |
| 104 | + logger.debug("Trace logging enabled for vlm-engine and multiplexer-llm") |
| 105 | + else: |
| 106 | + logger.setLevel(logging.WARNING) |
| 107 | + |
90 | 108 | async def initialize(self) -> None: |
91 | 109 | """Initialize the VLM Engine with configuration""" |
92 | 110 | if self._initialized: |
93 | 111 | return |
94 | 112 |
|
95 | 113 | try: |
| 114 | + self._configure_logging() |
96 | 115 | logger.info("Initializing Haven VLM Engine...") |
97 | 116 |
|
98 | 117 | # Convert config dict to EngineConfig objects |
@@ -176,7 +195,8 @@ def _create_engine_config(self) -> EngineConfig: |
176 | 195 | active_ai_models=vlm_config["active_ai_models"], |
177 | 196 | pipelines=pipelines, |
178 | 197 | models=models, |
179 | | - category_config=vlm_config["category_config"] |
| 198 | + category_config=vlm_config["category_config"], |
| 199 | + loglevel="DEBUG" if vlm_config.get("trace_logging", False) else "WARNING", |
180 | 200 | ) |
181 | 201 |
|
182 | 202 | async def process_video( |
|
0 commit comments