added logging statements

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

View File

@@ -38,7 +38,7 @@ log = logging.getLogger(__name__)
logging.basicConfig(
filename=os.environ.get("APP_LOG_PATH"),
level=logging.INFO,
format="[%(asctime)s, %(filename)s:%(lineno)s -> %(funcName)10s() ]%(levelname)s: %(message)s",
format="[%(asctime)s, %(filename)s:%(lineno)s -> %(funcName)10s()] %(levelname)s: %(message)s",
)
debug = log.debug
info = log.info
@@ -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}"
)
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)
scales_p = json.loads(pagescales)
@@ -592,6 +592,7 @@ def censor_pdf(
Returns:
None
"""
info(f"started Censoring for file {path} to be saved to {destpath}")
doc = pymupdf.open(path)
page = doc[0]
npage = doc.page_count
@@ -642,6 +643,7 @@ def censor_pdf_ocr(
Returns:
None
"""
info(f"started Censoring in OCR Mode for file {path} to be saved to {destpath}")
doc = pymupdf.open(path)
output = pymupdf.open()
page = doc[0]
@@ -738,7 +740,7 @@ def make_savepath(
pf = get_profpath(prof, lv[0])
pfpath = Path(pf[1])
catpath = Path(CATEGORIES[int(cat)])
scpath = ""
scpath: str | os.PathLike = ""
if int(cat) in SUBCAT_CATEGORIES_I and subcat != "":
sc = get_subcatpath(subcat, int(cat), pf[0], lv[0])
scpath = Path(sc[1])
@@ -770,6 +772,7 @@ def make_savepath(
i += 1
destpath = savepath / file
destpath.touch()
info(f"Path for file to be saved generated as: {savepath / file}")
return savepath / file