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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user