Handle empty docker log periods
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user