Open every line loop-claude prints with the machine's local time
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
from loop_claude.effects import Effects
|
||||
|
||||
|
||||
# The spelling `YYYY-MM-DD HH:MM:SS` in local time, never UTC, is lilleman's call of 2026-10-28.
|
||||
def say(text: str, effects: Effects, *, stdout: bool = False) -> None:
|
||||
"""Prints text on stderr, or on stdout where stdout, opening its first line with the machine's local time as `2026-10-28 11:46:01`, so the human sees when it happened. Blank lines before the text stay blank, and only its first line gets the time."""
|
||||
body = text.lstrip("\n")
|
||||
blanks = text[: len(text) - len(body)]
|
||||
stamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(effects.now()))
|
||||
print(f"{blanks}{stamp} {body}", file=sys.stdout if stdout else sys.stderr, flush=True)
|
||||
Reference in New Issue
Block a user