added logging statements

This commit is contained in:
Marcel Gansfusz
2025-10-30 14:45:53 +01:00
parent 90235d2788
commit a9233926e5

View File

@@ -487,7 +487,7 @@ async def get_submission(
f"lva: {lva}, prof: {prof}, fname {fname}, stype: {stype}, subcat: {subcat}, sem: {sem}, ex_date: {ex_date}, rects: {rects}, pagescales: {pagescales}, ocr: {ocr}" f"lva: {lva}, prof: {prof}, fname {fname}, stype: {stype}, subcat: {subcat}, sem: {sem}, ex_date: {ex_date}, rects: {rects}, pagescales: {pagescales}, ocr: {ocr}"
) )
info( info(
f"lva: {lva}, prof: {prof}, fname {fname}, stype: {stype}, subcat: {subcat}, sem: {sem}, ex_date: {ex_date}, rects: {rects}, pagescales: {pagescales}, ocr: {ocr}" f"Got Submission: lva: {lva}, prof: {prof}, fname {fname}, stype: {stype}, subcat: {subcat}, sem: {sem}, ex_date: {ex_date}, rects: {rects}, pagescales: {pagescales}, ocr: {ocr}"
) )
rects_p = json.loads(rects) rects_p = json.loads(rects)
scales_p = json.loads(pagescales) scales_p = json.loads(pagescales)
@@ -592,6 +592,7 @@ def censor_pdf(
Returns: Returns:
None None
""" """
info(f"started Censoring for file {path} to be saved to {destpath}")
doc = pymupdf.open(path) doc = pymupdf.open(path)
page = doc[0] page = doc[0]
npage = doc.page_count npage = doc.page_count
@@ -642,6 +643,7 @@ def censor_pdf_ocr(
Returns: Returns:
None None
""" """
info(f"started Censoring in OCR Mode for file {path} to be saved to {destpath}")
doc = pymupdf.open(path) doc = pymupdf.open(path)
output = pymupdf.open() output = pymupdf.open()
page = doc[0] page = doc[0]
@@ -738,7 +740,7 @@ def make_savepath(
pf = get_profpath(prof, lv[0]) pf = get_profpath(prof, lv[0])
pfpath = Path(pf[1]) pfpath = Path(pf[1])
catpath = Path(CATEGORIES[int(cat)]) catpath = Path(CATEGORIES[int(cat)])
scpath = "" scpath: str | os.PathLike = ""
if int(cat) in SUBCAT_CATEGORIES_I and subcat != "": if int(cat) in SUBCAT_CATEGORIES_I and subcat != "":
sc = get_subcatpath(subcat, int(cat), pf[0], lv[0]) sc = get_subcatpath(subcat, int(cat), pf[0], lv[0])
scpath = Path(sc[1]) scpath = Path(sc[1])
@@ -770,6 +772,7 @@ def make_savepath(
i += 1 i += 1
destpath = savepath / file destpath = savepath / file
destpath.touch() destpath.touch()
info(f"Path for file to be saved generated as: {savepath / file}")
return savepath / file return savepath / file