Files
rfcp/backend/app/utils/logging.py
mytec defa3ad440 @mytec: feat: Phase 3.0 Architecture Refactor
Major refactoring of RFCP backend:
- Modular propagation models (8 models)
- SharedMemoryManager for terrain data
- ProcessPoolExecutor parallel processing
- WebSocket progress streaming
- Building filtering pipeline (351k → 15k)
- 82 unit tests

Performance: Standard preset 38s → 5s (7.6x speedup)

Known issue: Detailed preset timeout (fix in 3.1.0)
2026-02-01 23:12:26 +02:00

35 lines
796 B
Python

"""
Structured logging for RFCP backend.
"""
import os
import sys
import time
import threading
_log_file = None
def rfcp_log(tag: str, msg: str):
"""Log with tag prefix, timestamp, and thread name.
Writes to stdout and a log file for reliability.
"""
global _log_file
ts = time.strftime('%H:%M:%S')
thr = threading.current_thread().name
line = f"[{tag} {ts}] [{thr}] {msg}"
print(line, flush=True)
try:
if _log_file is None:
log_dir = os.environ.get('RFCP_DATA_PATH', './data')
os.makedirs(log_dir, exist_ok=True)
log_path = os.path.join(log_dir, 'rfcp-backend.log')
_log_file = open(log_path, 'a')
_log_file.write(line + '\n')
_log_file.flush()
except Exception:
pass