Handle empty docker log periods

This commit is contained in:
2026-02-08 00:54:13 +03:00
parent be65398b86
commit 61236b9d60
2 changed files with 13 additions and 0 deletions

View File

@@ -117,6 +117,11 @@ async def logs_options(cb: CallbackQuery):
if action == "tail":
await cb.answer("Loading logs…")
rc, out = await docker_cmd(["logs", "--tail", "80", real])
if rc != 0:
await cb.message.answer(out)
return
if not out.strip():
out = "(no logs)"
await cb.message.answer(
f"📜 **Logs: {alias}**\n```{out}```",
parse_mode="Markdown"
@@ -132,6 +137,11 @@ async def logs_options(cb: CallbackQuery):
since_ts = str(int(time.time() - seconds))
await cb.answer("Loading logs…")
rc, out = await docker_cmd(["logs", "--since", since_ts, "--tail", "200", real])
if rc != 0:
await cb.message.answer(out)
return
if not out.strip():
out = "(no logs for period)"
await cb.message.answer(
f"📜 **Logs: {alias}**\n```{out}```",
parse_mode="Markdown"