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.
This commit is contained in:
Leo Vasanko
2026-06-15 23:14:18 +00:00
parent 96fd6b83dd
commit 652d60b74b
9 changed files with 359 additions and 78 deletions
+3 -4
View File
@@ -1,16 +1,15 @@
import logging
from kanta.logging import configure_logging, log_change
from kanta.logging import logger
from kanta.logging import changes_logger, configure_logging, log_change
def test_configure_logging():
configure_logging()
assert logger.level == logging.INFO
assert changes_logger.level == logging.INFO
def test_log_change_no_diff(capsys):
logger.handlers.clear()
changes_logger.handlers.clear()
configure_logging()
log_change("test", {})
captured = capsys.readouterr()