improved logging
This commit is contained in:
@@ -4,8 +4,11 @@ from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class ProcessingLiveConfig:
|
||||
@@ -148,6 +151,12 @@ class ProcessingLiveConfigWriter:
|
||||
|
||||
def write(self, config: ProcessingLiveConfig) -> Path:
|
||||
"""Atomically write config by temp-file replace."""
|
||||
# Hot path: rewritten on every live knob change, so keep this at DEBUG.
|
||||
logger.debug(
|
||||
"Writing live processing config (mode=%s) to %s",
|
||||
config.processor_mode,
|
||||
self._config_path,
|
||||
)
|
||||
temp_path = self._config_path.with_suffix(self._config_path.suffix + ".tmp")
|
||||
temp_path.write_text(json.dumps(config.to_dict(), indent=2), encoding="utf-8")
|
||||
temp_path.replace(self._config_path)
|
||||
|
||||
Reference in New Issue
Block a user