Commit Graph
31 Commits
Author SHA1 Message Date
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 e0725c5738 Kanta colors log header parts: extra is a plain string, logheader callbacks receive pre-colored parts 2026-08-07 00:31:04 +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 123e910873 Add @kanta.clock hook replacing the UTC clock for all record and snapshot timestamps 2026-08-06 23:55:09 +00:00
Leo Vasanko 5b0d676175 Add feature demo app under demo/ 2026-08-06 23:28:58 +00:00
Leo Vasanko 450952cd64 Document transaction log headers: extra, logheader, toggles 2026-08-06 23:07:05 +00:00
Leo Vasanko f4e0c66907 Tests for rich logging, apply ruff formatting 2026-08-06 23:06:24 +00:00
Leo Vasanko 1e9f83c800 Add rich transaction log headers: extra metadata, logheader callback, header/diff toggles, green add paths 2026-08-06 23:03:24 +00:00
Leo Vasanko 9c0b47ce38 Add kanta.bootstrap logger and configurable logging setup
- Bootstrap records are now logged via kanta.bootstrap at INFO level.
- Existing databases log 'Using <path>' at DEBUG on kanta.bootstrap.
- New databases log 'Created <path>' at INFO on kanta.bootstrap.
- Renamed loggers: kanta.changes -> kanta.transaction, kanta.migrations -> kanta.migration.
- configure_logging() gains bootstrap/migration/transaction/skiproot kwargs.
- Default configure_logging() attaches a no-prefix stderr handler to kanta and stops propagation.
- With skiproot=False, child logger propagation flags are still applied but kanta itself is left untouched.
- Updated tests and docstrings.
2026-06-20 19:10:58 +00:00
Leo Vasanko 3e1a86aee3 Log new database creation, bootstrap like a transaction. 2026-06-20 18:15:08 +00:00
Leo Vasanko 652d60b74b Add separate migration logging, logmigr callback, and log= override
- Split transaction logger (kanta.changes) and migration logger (kanta.migrations).
- Migrations.apply() now returns MigrationResult instead of logging.
- Kanta.open() emits one info summary per DB and debug transaction per migration.
- Add open(log=...) to suppress/redirect default migration logging.
- Add @kanta.logmigr callback for custom migration logging/summaries.
- Add transaction(log=...) to suppress/redirect transaction logging.
- Update tests for the new MigrationResult API and logging behaviour.
2026-06-15 23:14:18 +00:00
Leo Vasanko 96fd6b83dd Revised migration context: don't store changerecord unless something was changed, and always snapshot if and after changes done. 2026-06-15 22:14:03 +00:00
Leo Vasanko 1642b3f876 Stricter versioning: always store migrate version record, file must be within versions included in migrations. Log only for migrations that made changes. Allow deleting older migration functions when no longer required. 2026-06-15 03:09:45 +00:00
Leo Vasanko 526cd6eb80 Refactor Migrations internals, add caching to avoid reloading per each Kanta instance. Naming changed from MigrationRegistry to Migration, module from migrate to kanta.migrations. 2026-06-15 01:12:42 +00:00
Leo Vasanko c1d01d3b1c Fix creation of new database, ensuring that a bootstrap record of the initial state is always written. 2026-06-15 00:32:54 +00:00
Leo Vasanko 26101bc028 Add kanta.ctx SimpleNamespace for user variables. This is passed to migration functions if they take a second argument. Remove the old MigrationCtx system. 2026-06-14 19:54:23 +00:00
Leo Vasanko 3e6210d0e9 Add read only mode that doesn't use locking. Useful for inspection while the database is in use or when no changes are intended (except in RAM). 2026-06-14 19:35:06 +00:00
Leo Vasanko 1cda44f328 Only Kanta exported at root, others available from submodules. 2026-06-13 21:26:35 +00:00
Leo Vasanko 384b4fba4f Improved log formatting support by @kanta.logfmt, which replaces old resolver and user_display arguments (breaking change). 2026-06-13 21:22:05 +00:00
Leo Vasanko 7a74662df0 Implement proper bootstrap and fatal error handling via decorators. Breaks compatibility. 2026-06-13 02:58:29 +00:00
Leo Vasanko 17e12e5180 Fixed typing. 2026-06-13 00:59:18 +00:00
Leo Vasanko fe66483477 Removed useless lock. 2026-06-13 00:55:05 +00:00
Leo Vasanko 74150b783c Proper ts/mtime setting and tracking. Added Kanta.mtime property for reading current change time. 2026-06-13 00:49:35 +00:00
Leo Vasanko 97209b8556 Don't make package root a module (debug). 2026-06-13 00:31:07 +00:00
Leo Vasanko 9085fc6961 Fix imports 2026-06-12 19:25:47 +00:00
Leo Vasanko afebad72df Initial commit 2026-06-12 19:18:15 +00:00