mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
refactor(debug): remove dead _read_log_tail/_read_full_log wrappers
These thin wrappers around _capture_log_snapshot had zero production callers after the snapshot refactor — run_debug_share uses snapshots directly and collect_debug_report captures internally. The wrappers also caused a performance regression: _read_log_tail read up to 512KB and built full_text just to return tail_text. Remove both wrappers and migrate TestReadFullLog → TestCaptureLogSnapshot to test _capture_log_snapshot directly. Same coverage, tests the real API instead of dead indirection.
This commit is contained in:
parent
8dc936f10e
commit
de849c410d
2 changed files with 44 additions and 52 deletions
|
|
@ -428,20 +428,6 @@ def _capture_log_snapshot(
|
|||
return LogSnapshot(path=log_path, tail_text=f"(error reading: {exc})", full_text=None)
|
||||
|
||||
|
||||
def _read_log_tail(log_name: str, num_lines: int) -> str:
|
||||
"""Read the last *num_lines* from a log file, or return a placeholder."""
|
||||
return _capture_log_snapshot(log_name, tail_lines=num_lines).tail_text
|
||||
|
||||
|
||||
def _read_full_log(log_name: str, max_bytes: int = _MAX_LOG_BYTES) -> Optional[str]:
|
||||
"""Read a log file for standalone upload.
|
||||
|
||||
Returns the file content (last *max_bytes* if truncated), or None if the
|
||||
file doesn't exist or is empty.
|
||||
"""
|
||||
return _capture_log_snapshot(log_name, tail_lines=1, max_bytes=max_bytes).full_text
|
||||
|
||||
|
||||
def _capture_default_log_snapshots(log_lines: int) -> dict[str, LogSnapshot]:
|
||||
"""Capture all logs used by debug-share exactly once."""
|
||||
errors_lines = min(log_lines, 100)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue