From 1091387f48115db1c8f35675b67996abfc2d5353 Mon Sep 17 00:00:00 2001 From: jonaswinkler <17569239+jonaswinkler@users.noreply.github.com> Date: Sat, 10 Apr 2021 14:38:39 +0200 Subject: [PATCH] better logging for the retagger --- src/documents/management/commands/document_retagger.py | 5 ++--- src/documents/signals/handlers.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/documents/management/commands/document_retagger.py b/src/documents/management/commands/document_retagger.py index 854117fdd..4a23faa86 100755 --- a/src/documents/management/commands/document_retagger.py +++ b/src/documents/management/commands/document_retagger.py @@ -1,5 +1,6 @@ import logging +import tqdm from django.core.management.base import BaseCommand from documents.classifier import load_classifier @@ -67,9 +68,7 @@ class Command(BaseCommand): classifier = load_classifier() - for document in documents: - logger.info( - f"Processing document {document.title}") + for document in tqdm.tqdm(documents): if options['correspondent']: set_correspondent( diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py index ad63bf301..f46adbb16 100755 --- a/src/documents/signals/handlers.py +++ b/src/documents/signals/handlers.py @@ -46,13 +46,13 @@ def set_correspondent(sender, selected = None if potential_count > 1: if use_first: - logger.info( + logger.debug( f"Detected {potential_count} potential correspondents, " f"so we've opted for {selected}", extra={'group': logging_group} ) else: - logger.info( + logger.debug( f"Detected {potential_count} potential correspondents, " f"not assigning any correspondent", extra={'group': logging_group}