"""P4LOG file tailing via log2sql subprocess (go-libp4dlog). Tails P4LOG in real time and emits parsed command records as JSON into the rolling SQLite window. """ from __future__ import annotations import logging from pathlib import Path logger = logging.getLogger(__name__) class P4LogTailer: """Tails a P4LOG file using log2sql (go-libp4dlog) in JSON output mode. Prefer shelling out to log2sql over a native Python parser to inherit go-libp4dlog's edge-case handling and test coverage. """ def __init__(self, log_path: Path, db_path: Path, log2sql_bin: Path) -> None: """ Args: log_path: Path to the P4LOG file to tail. db_path: SQLite database path for the rolling window. log2sql_bin: Path to the log2sql binary from go-libp4dlog. """ raise NotImplementedError def start(self) -> None: """Start tailing the log file. Handles log rotation gracefully.""" raise NotImplementedError def stop(self) -> None: """Stop tailing and flush any pending records.""" raise NotImplementedError