Add debug logging for extractor

This commit is contained in:
Marty Oehme 2023-08-28 12:53:03 +02:00
parent df235caf8f
commit 1bb1b80620
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 9 additions and 2 deletions

View file

@ -88,11 +88,11 @@ def _add_annots_to_note(
f.write("\n".join(new_annotations))
f.write("\n")
logger.info(
f"Wrote {len(new_annotations)} annotations "\
f"Wrote {len(new_annotations)} "
f"{'annotation' if len(new_annotations) == 1 else 'annotations'}"
f"to {papis.document.describe(document)}"
)
if git:
msg = "Update notes for '{0}'".format(papis.document.describe(document))
folder = document.get_main_folder()

View file

@ -2,12 +2,15 @@ from pathlib import Path
import Levenshtein
import fitz_new as fitz
import papis.logging
import papis.config
from papis_extract.annotation_data import Annotation
COLOR_MAPPING = {}
logger = papis.logging.get_logger(__name__)
def start(filename: Path) -> list[Annotation]:
"""Extract annotations from a file.
@ -30,6 +33,10 @@ def start(filename: Path) -> list[Annotation]:
)
a.tag = _tag_from_colorname(a.colorname)
annotations.append(a)
logger.debug(
f"Found {len(annotations)} "
f"{'annotation' if len(annotations) == 1 else 'annotations'} for {filename}."
)
return annotations