Skip to main content

Module log

Module log 

Source
Expand description

log — the append-only, month-rotating chronological log.

One logical timeline: the active log.md at the store root plus log/<YYYY-MM>.md archives. Log::append rolls older months into archives on write so the active file stays current-month. Log::tail and Log::since reverse-read from EOF. Both read each file they touch in full — the on-disk order is not guaranteed monotonic, so neither can early-stop within a file — and select by timestamp: tail keeps the n newest, since keeps everything newer than the cutoff. Both cross into month archives only as far back as the requested window reaches (by the cutoff’s month for since, by the current nth-newest’s month for tail) — never the whole history.

Append-only contract: there is no rewrite API. Corrective entries go on the end; out-of-order timestamps are a validate warning (LOG_OUT_OF_ORDER), signalling a probable rewrite.

Structs§

Log
The store’s chronological log: a thin handle for the append-only timeline. All methods take the Store so they resolve the active log.md and the log/ archives under the store root.
LogEntry
One parsed log.md entry: a header (## [YYYY-MM-DD HH:MM] <kind> | <object>) plus its body.

Enums§

LogKind
A recognized log.md entry kind. Custom kinds are valid in the format (dbmd validate warns on unrecognized via LOG_UNKNOWN_KIND); this enum carries the recognized vocabulary plus a LogKind::Custom catch-all so an unknown kind round-trips without loss.