Skip to content

Commit c7c65ce

Browse files
authored
Merge pull request #11 from nkhdiscovery/claude/add-logging-timestamps-l1pqO
Add timestamps to agent terminal output and daily log files
2 parents e51e3f8 + d38ce31 commit c7c65ce

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

scripts/launch-agent.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,30 @@ echo ""
9191

9292
# Filter stream-json into human-readable lines.
9393
#
94-
# - assistant text -> the line as-is
95-
# - assistant tool -> "→ Name(short input)"
96-
# - tool_result -> " result: <truncated>"
97-
# - rate_limit -> "[rate limit] <status>"
98-
# - non-JSON lines (launcher messages, git output) pass through verbatim
94+
# - assistant text -> "[HH:MM:SS] the line as-is"
95+
# - assistant tool -> "[HH:MM:SS] → Name(short input)"
96+
# - tool_result -> "[HH:MM:SS] result: <truncated>"
97+
# - rate_limit -> "[HH:MM:SS] [rate limit] <status>"
98+
# - non-JSON lines (launcher messages, git output) pass through verbatim with timestamp
9999
HUMANISE='
100+
(now | strftime("%Y-%m-%d %H:%M:%S")) as $ts |
100101
. as $raw |
101102
(try fromjson catch null) as $j |
102103
if $j == null then
103-
$raw
104+
"\($ts) \($raw)"
104105
elif $j.type == "assistant" then
105106
($j.message.content[]? |
106-
if .type == "text" then .text
107+
if .type == "text" then "\($ts) \(.text)"
107108
elif .type == "tool_use" then
108-
"→ \(.name)(" + ((.input | tostring)[:100]) + ")"
109+
"\($ts) → \(.name)(" + ((.input | tostring)[:100]) + ")"
109110
else empty end)
110111
elif $j.type == "user" then
111112
($j.message.content[]? |
112113
if .type == "tool_result" then
113-
" result: " + ((.content | tostring | gsub("\n"; " "))[:200])
114+
"\($ts) result: " + ((.content | tostring | gsub("\n"; " "))[:200])
114115
else empty end)
115116
elif $j.type == "rate_limit_event" then
116-
"[rate limit] " + $j.rate_limit_info.status
117+
"\($ts) [rate limit] " + $j.rate_limit_info.status
117118
else empty end
118119
'
119120

0 commit comments

Comments
 (0)