Cleanup logging, timing as debug.
This commit is contained in:
parent
6738946636
commit
1d41a98756
@ -90,18 +90,13 @@ def process_image(path, *, maxsize, quality):
|
|||||||
load_ms = (t_load_end - t_load_start) * 1000
|
load_ms = (t_load_end - t_load_start) * 1000
|
||||||
proc_ms = (t_proc_end - t_proc_start) * 1000
|
proc_ms = (t_proc_end - t_proc_start) * 1000
|
||||||
save_ms = (t_save_end - t_save_start) * 1000
|
save_ms = (t_save_end - t_save_start) * 1000
|
||||||
logger.info(
|
logger.debug(
|
||||||
"Preview image %s: load=%.1fms process=%.1fms save=%.1fms out=%.1fKB %dx%d -> %dx%d q=%d",
|
"Preview image %s: load=%.1fms process=%.1fms save=%.1fms out=%.1fKB",
|
||||||
path.name,
|
path.name,
|
||||||
load_ms,
|
load_ms,
|
||||||
proc_ms,
|
proc_ms,
|
||||||
save_ms,
|
save_ms,
|
||||||
len(ret) / 1024,
|
len(ret) / 1024,
|
||||||
orig_w,
|
|
||||||
orig_h,
|
|
||||||
getattr(img, "width", 0),
|
|
||||||
getattr(img, "height", 0),
|
|
||||||
quality,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
@ -121,16 +116,12 @@ def process_pdf(path, *, maxsize, maxzoom, quality, page_number=0):
|
|||||||
ret = pix.pil_tobytes(format="avif", quality=quality, speed=10, max_threads=1)
|
ret = pix.pil_tobytes(format="avif", quality=quality, speed=10, max_threads=1)
|
||||||
t_save_end = perf_counter()
|
t_save_end = perf_counter()
|
||||||
|
|
||||||
logger.info(
|
logger.debug(
|
||||||
"Preview pdf %s: load+render=%.1fms save=%.1fms out=%.1fKB page=%d zoom=%.2f",
|
"Preview pdf %s: load+render=%.1fms save=%.1fms",
|
||||||
path.name,
|
path.name,
|
||||||
(t_load_end - t_load_start) * 1000,
|
(t_load_end - t_load_start) * 1000,
|
||||||
(t_save_end - t_save_start) * 1000,
|
(t_save_end - t_save_start) * 1000,
|
||||||
len(ret) / 1024,
|
|
||||||
page_number,
|
|
||||||
zoom,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
@ -222,18 +213,12 @@ def process_video(path, *, maxsize, quality):
|
|||||||
t_save_end = perf_counter()
|
t_save_end = perf_counter()
|
||||||
|
|
||||||
# Capture frame dimensions before cleanup
|
# Capture frame dimensions before cleanup
|
||||||
fw = getattr(frame, "width", 0) if frame else 0
|
|
||||||
fh = getattr(frame, "height", 0) if frame else 0
|
|
||||||
ret = imgdata.getvalue()
|
ret = imgdata.getvalue()
|
||||||
logger.info(
|
logger.debug(
|
||||||
"Preview video %s: load+decode=%.1fms save=%.1fms out=%.1fKB dims=%dx%d q=%d",
|
"Preview video %s: load+decode=%.1fms save=%.1fms",
|
||||||
path.name,
|
path.name,
|
||||||
(t_load_end - t_load_start) * 1000,
|
(t_load_end - t_load_start) * 1000,
|
||||||
(t_save_end - t_save_start) * 1000,
|
(t_save_end - t_save_start) * 1000,
|
||||||
len(ret) / 1024,
|
|
||||||
fw,
|
|
||||||
fh,
|
|
||||||
quality,
|
|
||||||
)
|
)
|
||||||
del imgdata, istream, ostream, icc, occ, frame
|
del imgdata, istream, ostream, icc, occ, frame
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user