added logging statements
This commit is contained in:
@@ -38,7 +38,7 @@ log = logging.getLogger(__name__)
|
|||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
filename=os.environ.get("APP_LOG_PATH"),
|
filename=os.environ.get("APP_LOG_PATH"),
|
||||||
level=logging.INFO,
|
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
|
debug = log.debug
|
||||||
info = log.info
|
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}"
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user