diff options
Diffstat (limited to 'app/backends')
| -rw-r--r-- | app/backends/audiocpp/build.py | 12 | ||||
| -rw-r--r-- | app/backends/common.py | 7 | ||||
| -rw-r--r-- | app/backends/servers.py | 4 |
3 files changed, 11 insertions, 12 deletions
diff --git a/app/backends/audiocpp/build.py b/app/backends/audiocpp/build.py index 9ffe429..1ad6018 100644 --- a/app/backends/audiocpp/build.py +++ b/app/backends/audiocpp/build.py @@ -6,10 +6,11 @@ import os import re import shlex import shutil -from datetime import datetime from pathlib import Path from typing import List, Optional +import logging_kit + from backends import common, servers from backends.common import APP_DIR from .catalog import _BACKEND_TOKEN_RE, detect_backend, load_server_config @@ -490,14 +491,11 @@ def _build_audiocpp_tui(emit, cancel, argv: List[str], command: str, cancelled build (CANCEL set) is not reported as a failure, but its partial output stays in the log file. """ - log_path = common.LOG_DIR / ( - f"audiocpp_build_{datetime.now():%Y%m%d_%H%M%S}.log") - log_path.parent.mkdir(parents=True, exist_ok=True) - log_handle = log_path.open("w", encoding="utf-8") + log_path, log_handle = logging_kit.run_artifact("audiocpp_build", + log_dir=common.LOG_DIR) def tee(line: str) -> None: - log_handle.write(line + "\n") - log_handle.flush() + logging_kit.write_line(log_handle, line) emit(line) class _TeeWriter(io.TextIOBase): diff --git a/app/backends/common.py b/app/backends/common.py index 4c768b8..d25a03e 100644 --- a/app/backends/common.py +++ b/app/backends/common.py @@ -17,6 +17,8 @@ import urllib.parse from pathlib import Path from typing import Dict, List, Optional, Set, Tuple +import logging_kit + # Messages queued while the TUI is on screen, printed to the real console # after the curses session ends (see ui.hub.run). Build/setup steps that # fail inside the TUI record here so the user gets a copy-pastable command @@ -32,8 +34,9 @@ TTS_ROOT = Path(__file__).resolve().parent.parent.parent # The single "everything else" directory under TTS_ROOT. APP_DIR = TTS_ROOT / "app" -# app/logs — build/server/conversion logs (already gitignored). -LOG_DIR = APP_DIR / "logs" +# app/logs — build/server/conversion logs (already gitignored). Naming and +# retention policy lives in logging_kit (streams vs. timestamped artifacts). +LOG_DIR = logging_kit.LOG_DIR # The project's sample-voice directory: .wav files dropped here are offered # as the default source when a setup/configure wizard asks for a wav diff --git a/app/backends/servers.py b/app/backends/servers.py index 986d82a..c258398 100644 --- a/app/backends/servers.py +++ b/app/backends/servers.py @@ -32,9 +32,7 @@ from pathlib import Path from typing import Callable, List, Optional from backends import common, probe -from backends.common import APP_DIR - -LOG_DIR = APP_DIR / "logs" +from backends.common import LOG_DIR # How long to wait for a server to accept connections on its URL. First-time # model loads (especially qwen-tts / faster-qwen3-tts pulling weights into |
