Commit Graph
11 Commits
Author SHA1 Message Date
Leo Vasanko f131f72749 Demo: simplify resolve_user to a plain previous-state lookup 2026-08-07 05:31:48 +00:00
Leo Vasanko 54d01f1e74 Fortify logging: no logging failure may break functionality
emit_event now swallows and reports any failure, including crashes in the
built-in default_emit formatting itself; log_change routes through it.
logfmt chain callbacks that raise are logged and treated as fall-through,
and logmigr callbacks get on_error reporting like fatal_error handlers,
so a broken logging callback can no longer abort a transaction or open.

Demo: raw user ids in v0 logs, logfmt-resolved names in v1 logs.
2026-08-07 05:23:33 +00:00
Leo Vasanko 6eb9087863 Add logemit event callbacks and kanta.tty terminal formatting
All change-related output (transactions, bootstrap, migrations) is now
described by a mutable LogEvent carrying full state plus the preferred
logger and level, and dispatched through emit_event. @kanta.logemit
callbacks receive the event and decide what is logged where: falsy return
marks it handled, truthy passes it (possibly modified) down the chain,
with default_emit - Kanta's own formatting, now just another emitter - as
the fallback. Pretty header and diff lines are lazy event properties.

New kanta.tty module: Line builder (call to append content, .colorname
arms a palette color for the next call with automatic folded reset,
width/align padding), a mutable Colors palette storing bare SGR params
(0 clears, sequential last-wins stacking), and strip_ansi/displaywidth/pad
helpers that count wide chars and emoji correctly.
2026-08-07 05:11:54 +00:00
Leo Vasanko e42f81f44f Replace log dict toggles with logdiff kwarg and kanta.transaction.diff logger
Per-transaction logdiff=False skips building and printing the diff body,
logging only the header. Globally, configure_logging(diff=False) disables
the kanta.transaction.diff child logger, which now carries all diff lines,
so applications can route or silence diffs separately from headers.
2026-08-07 01:26:50 +00:00
Leo Vasanko 9e19a1bf21 Remove logheader callback feature; keep Kanta-colored extra string in default header 2026-08-07 00:44:06 +00:00
Leo Vasanko 1cd99aef01 Demo: plain-text custom header colored by Kanta, rename migration, str extras 2026-08-07 00:33:56 +00:00
Leo Vasanko ec08c185aa Demo: use the script itself as the migrations module 2026-08-07 00:08:50 +00:00
Leo Vasanko 72944c9410 Demo: resolve user names from database state, kanta instances at top with stacked decorators 2026-08-07 00:06:54 +00:00
Leo Vasanko 5d66d423da Lazy clock reads; demo: auto-advancing +1h clock, module-level setup 2026-08-07 00:01:16 +00:00
Leo Vasanko 8d9e948d27 Demo: deterministic clock, # section banners, .kantadb extension, raw record dump 2026-08-06 23:57:00 +00:00
Leo Vasanko 5b0d676175 Add feature demo app under demo/ 2026-08-06 23:28:58 +00:00