MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _cmd_logs

Function _cmd_logs

uncommon_route/cli.py:815–842  ·  view source on GitHub ↗
(args: list[str])

Source from the content-addressed store, hash-verified

813
814
815def _cmd_logs(args: list[str]) -> None:
816 flags, _ = _parse_flags(args, {"limit": True, "follow": False})
817 limit = int(flags.get("limit", 50))
818 follow = bool(flags.get("follow"))
819
820 if not _LOG_FILE.exists():
821 print(" No log file found")
822 print(" Start the proxy in background: uncommon-route serve --daemon")
823 return
824
825 if follow:
826 print(f" Tailing {_LOG_FILE} (Ctrl+C to stop)")
827 try:
828 with open(_LOG_FILE) as f:
829 f.seek(0, 2)
830 while True:
831 line = f.readline()
832 if line:
833 print(line, end="")
834 else:
835 time.sleep(0.3)
836 except KeyboardInterrupt:
837 pass
838 return
839
840 lines = _LOG_FILE.read_text().splitlines()
841 for line in lines[-limit:]:
842 print(line)
843
844
845_ANSI_RESET = "\x1b[0m"

Callers

nothing calls this directly

Calls 3

_parse_flagsFunction · 0.85
openFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected