| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Log
Contents
Description
Generic JSONL logs with YAML-frontmattered bodies.
Each line in the log is a JSON envelope
{ "id": N, "ts": "...", "from": "...", "to": [], "thread": ["...", ...], "body": "..." }.
The body is expected to be a markdown string with optional YAML frontmatter.
from is the card basename; thread is the raw residual-of names the
card depends on (backward edges, stamped verbatim — no id resolution).
to is always empty: forward edges (feeds-into) are banned.
The reader tolerates the historical mixed schema: entries written before
19 Aug 2026 carry fromtothread; entries written between 19 Aug
2026 and the envelope restore carry only idtsbody. A missing
fromthread defaults to ""[] on read.
Synopsis
- newtype LogConfig = LogConfig {}
- defaultLogConfig :: LogConfig
- data LogEntry = LogEntry {}
- readLog :: LogConfig -> IO [LogEntry]
- readLogEither :: LogConfig -> IO [Either String LogEntry]
- nextId :: [LogEntry] -> Int
- renderEntry :: LogEntry -> Text
- appendEntry :: LogConfig -> Text -> [Text] -> Text -> IO ()
- formatUtc :: UTCTime -> Text
Configuration
Configuration for a log file.
defaultLogConfig :: LogConfig Source #
Default log configuration.
Points at the coffee permanent archive. Override logPath for other logs.
Entries
One log entry.
Constructors
| LogEntry | |
readLog :: LogConfig -> IO [LogEntry] Source #
Read all entries from the log.
Fails on the first parse error. For fault-tolerant reading, use
readLogEither.
readLogEither :: LogConfig -> IO [Either String LogEntry] Source #
Read all entries, preserving parse errors.
nextId :: [LogEntry] -> Int Source #
Next id for a log: one greater than the maximum existing id, or 1.
renderEntry :: LogEntry -> Text Source #
Render one entry as a single JSONL line.