better logging for the retagger

This commit is contained in:
jonaswinkler 2021-04-10 14:38:39 +02:00
parent 4db75537cb
commit 1091387f48
2 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,6 @@
import logging import logging
import tqdm
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from documents.classifier import load_classifier from documents.classifier import load_classifier
@ -67,9 +68,7 @@ class Command(BaseCommand):
classifier = load_classifier() classifier = load_classifier()
for document in documents: for document in tqdm.tqdm(documents):
logger.info(
f"Processing document {document.title}")
if options['correspondent']: if options['correspondent']:
set_correspondent( set_correspondent(

View File

@ -46,13 +46,13 @@ def set_correspondent(sender,
selected = None selected = None
if potential_count > 1: if potential_count > 1:
if use_first: if use_first:
logger.info( logger.debug(
f"Detected {potential_count} potential correspondents, " f"Detected {potential_count} potential correspondents, "
f"so we've opted for {selected}", f"so we've opted for {selected}",
extra={'group': logging_group} extra={'group': logging_group}
) )
else: else:
logger.info( logger.debug(
f"Detected {potential_count} potential correspondents, " f"Detected {potential_count} potential correspondents, "
f"not assigning any correspondent", f"not assigning any correspondent",
extra={'group': logging_group} extra={'group': logging_group}