Skip to content

Commit 72ff6f6

Browse files
Change pghistory backfill log level from ERROR to DEBUG for missing event tables
When migration 0250 runs before migration 0256 creates the tags event tables, it logs ERROR messages for missing tables. These are expected during migration sequencing and should be DEBUG level instead. Changes: - Update auditlog.py to log at DEBUG level when event tables don't exist - Update progress_callback functions in migrations 0250 and 0257 to handle DEBUG level
1 parent 1a61804 commit 72ff6f6

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

dojo/auditlog.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,16 @@ def process_model_backfill(
774774
"""
775775
if progress_callback is None:
776776
def progress_callback(msg, style=None):
777-
logger.info(msg)
777+
if style == "ERROR":
778+
logger.error(msg)
779+
elif style == "WARNING":
780+
logger.warning(msg)
781+
elif style == "SUCCESS":
782+
logger.info(msg)
783+
elif style == "DEBUG":
784+
logger.debug(msg)
785+
else:
786+
logger.info(msg)
778787

779788
try:
780789
table_name, event_table_name = get_table_names(model_name)
@@ -790,7 +799,7 @@ def progress_callback(msg, style=None):
790799
progress_callback(
791800
f" Event table {event_table_name} not found. "
792801
f"Is {model_name} tracked by pghistory?",
793-
"ERROR",
802+
"DEBUG",
794803
)
795804
return 0, 0.0
796805

dojo/db_migrations/0250_pghistory_backfill.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def progress_callback(msg, style=None):
4343
logger.warning(msg)
4444
elif style == "SUCCESS":
4545
logger.info(msg)
46+
elif style == "DEBUG":
47+
logger.debug(msg)
4648
else:
4749
logger.info(msg)
4850

dojo/db_migrations/0257_pghistory_tags_backfill.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def progress_callback(msg, style=None):
5656
logger.warning(msg)
5757
elif style == "SUCCESS":
5858
logger.info(msg)
59+
elif style == "DEBUG":
60+
logger.debug(msg)
5961
else:
6062
logger.info(msg)
6163

0 commit comments

Comments
 (0)