refactor: implement structured logging across multiple modules

- Introduced logging functionality in cli.py, run_agent.py, scheduler.py, and various tool modules to replace print statements with structured logging.
- Enhanced error handling and informational messages to improve debugging and monitoring capabilities.
- Ensured consistent logging practices across the codebase, facilitating better traceability and maintenance.
This commit is contained in:
teknium1 2026-02-21 03:11:11 -08:00
parent b6247b71b5
commit a885d2f240
14 changed files with 303 additions and 303 deletions

View file

@ -21,10 +21,13 @@ Usage:
print(result["transcript"])
"""
import logging
import os
from pathlib import Path
from typing import Optional
logger = logging.getLogger(__name__)
# Default STT model -- cheapest and widely available
DEFAULT_STT_MODEL = "whisper-1"
@ -85,7 +88,7 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> dict:
# The response is a plain string when response_format="text"
transcript_text = str(transcription).strip()
print(f"[STT] Transcribed {audio_path.name} ({len(transcript_text)} chars)", flush=True)
logger.info("Transcribed %s (%d chars)", audio_path.name, len(transcript_text))
return {
"success": True,
@ -93,7 +96,7 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> dict:
}
except Exception as e:
print(f"[STT] Transcription error: {e}", flush=True)
logger.error("Transcription error: %s", e)
return {
"success": False,
"transcript": "",