Files
hermes-agent/apps/desktop/electron/desktop-log-line.ts
T
Chen Jin 1dbeb47497 fix(desktop): timestamp every desktop.log / RECENT LOGS line
rememberLog prepended only '[hermes] ' to each line, so desktop.log and
the in-app RECENT LOGS view carried no timestamps while agent.log and
gateway.log (Python logging) did.

Extract the line format into a small pure helper (desktop-log-line.ts)
and prefix each line with an ISO-8601 UTC timestamp shared per chunk,
matching the Python-side convention. Regression tests assert the shape
contract: timestamp + [hermes] tag + verbatim message. Fixes #84405.
2026-08-15 01:04:19 -07:00

20 lines
798 B
TypeScript

/**
* Desktop log line formatting shared by every desktop log surface:
* `desktop.log`, the in-app "RECENT LOGS" view, and crash forensics.
*
* Historically each line was prefixed with just `[hermes] `, so lines from
* different moments were indistinguishable. Every surface now carries an
* ISO-8601 UTC timestamp, matching the Python-side `agent.log` /
* `gateway.log` convention (`2026-07-12 16:22:17,540 INFO ...`). See #84405.
*/
/**
* Format one desktop log line with an ISO-8601 UTC timestamp.
*
* `stamp` defaults to now; callers that batch multiple lines (a single
* stdout chunk) pass one shared stamp so the group reads as one event.
*/
export function formatDesktopLogLine(text: string, stamp = new Date().toISOString()): string {
return `[${stamp}] [hermes] ${text}`
}