From dd44d9b17465b6dea93b038dd8ab7d86ffaf0943 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Wed, 11 Dec 2019 01:11:06 +0000 Subject: [PATCH] Adjust logging levels: log individual request failures only at WARNING and cancelled tasks at ERROR level --- qwarc/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qwarc/__init__.py b/qwarc/__init__.py index cf63f06..a739320 100644 --- a/qwarc/__init__.py +++ b/qwarc/__init__.py @@ -86,7 +86,7 @@ class Item: self.stats['rx'] += rx self.stats['requests'] += 1 except (asyncio.TimeoutError, _aiohttp.ClientError) as e: - self.logger.error(f'Request for {url} failed: {e!r}') + self.logger.warning(f'Request for {url} failed: {e!r}') action, writeToWarc = await responseHandler(url, attempt, response, e) exc = e # Pass the exception outward for the history else: @@ -225,7 +225,7 @@ class QWARC: except concurrent.futures.CancelledError as e: # Got cancelled, nothing we can do about it, but let's log a warning if it's a process task if future.taskType == 'process': - logging.warning(f'Task for {future.itemType}:{future.itemValue} cancelled: {future!r}') + logging.error(f'Task for {future.itemType}:{future.itemValue} cancelled: {future!r}') newStatus = STATUS_ERROR except Exception as e: if future.taskType == 'process':