Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: log requests cache activity (#760)

NTFSvolume07e4dae1e552
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
index 443e89a61..4c7e62b5f 100644
--- a/cyberdrop_dl/main.py
+++ b/cyberdrop_dl/main.py
@@ -188,6 +188,10 @@ def setup_debug_logger(manager: Manager) -> Path | None:
add_custom_log_render(file_handler_debug)
logger_debug.addHandler(file_handler_debug)
+ aiohttp_client_cache_logger = logging.getLogger("aiohttp_client_cache")
+ aiohttp_client_cache_logger.setLevel(log_level)
+ aiohttp_client_cache_logger.addHandler(file_handler_debug)
+
# aiosqlite_log = logging.getLogger("aiosqlite")
# aiosqlite_log.setLevel(log_level)
# aiosqlite_log.addHandler(file_handler_debug)
diff --git a/cyberdrop_dl/utils/logger.py b/cyberdrop_dl/utils/logger.py
index e5e1fba33..5322ac3a6 100644
--- a/cyberdrop_dl/utils/logger.py
+++ b/cyberdrop_dl/utils/logger.py
@@ -30,6 +30,9 @@ if TYPE_CHECKING:
from rich.logging import RichHandler
+EXCLUDE_PATH_LOGGING_FROM = "logger.py", "base.py", "session.py", "cache_control.py"
+
+
class NoPaddingLogRender(LogRender):
cdl_padding = 0
@@ -67,7 +70,7 @@ class NoPaddingLogRender(LogRender):
if not self.cdl_padding:
self.cdl_padding = get_renderable_length(output)
- if self.show_path and path and "logger.py" not in path:
+ if self.show_path and path and not any(path.startswith(p) for p in EXCLUDE_PATH_LOGGING_FROM):
path_text = Text(style="log.path")
path_text.append(path, style=f"link file://{link_path}" if link_path else "")
if line_no: