mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 04:11:35 +00:00
desktop.log stamped each line with an ISO-8601 UTC time in brackets (`[2026-09-28T07:48:19.466Z]`), while agent.log, gui.log and errors.log use Python's local-time asctime (`2026-09-28 13:18:46,062`). Reading one incident across logs/ meant converting clocks by hand, and `hermes logs desktop --since 1h` returned every desktop line, because its timestamp regex expects the Python shape at the start of the line and lines it cannot parse pass the filter. formatLogStamp() now emits the Python shape in local time, and formatDesktopLogLine() puts it first: `2026-09-28 13:18:46,062 [hermes] ...`. The #84405 comment already said the stamp matched the Python convention; now it does.
19 lines
907 B
TypeScript
19 lines
907 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { formatDesktopLogLine, formatLogStamp } from './desktop-log-line'
|
|
|
|
describe('formatDesktopLogLine', () => {
|
|
it('stamps lines with the local wall-clock time, in the shape Python logs use', () => {
|
|
// Built from local components, so the assertion holds in every time zone:
|
|
// the stamp must name the same local moment agent.log would print for it.
|
|
const moment = new Date(2026, 8, 3, 7, 5, 9, 42)
|
|
const line = formatDesktopLogLine('[boot] Resolving Hermes backend', formatLogStamp(moment))
|
|
|
|
const match = /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}),(\d{3}) \[hermes\] (.*)$/.exec(line)
|
|
|
|
expect(match).not.toBeNull()
|
|
const [, y, mo, d, h, mi, s, ms, text] = match!
|
|
expect(new Date(+y, +mo - 1, +d, +h, +mi, +s, +ms).getTime()).toBe(moment.getTime())
|
|
expect(text).toBe('[boot] Resolving Hermes backend')
|
|
})
|
|
})
|