diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/wikiget/client.py | 2 | ||||
| -rw-r--r-- | src/wikiget/dl.py | 14 | ||||
| -rw-r--r-- | src/wikiget/parse.py | 2 | ||||
| -rw-r--r-- | src/wikiget/wikiget.py | 4 |
4 files changed, 13 insertions, 9 deletions
diff --git a/src/wikiget/client.py b/src/wikiget/client.py index 69051a7..f746386 100644 --- a/src/wikiget/client.py +++ b/src/wikiget/client.py @@ -29,7 +29,7 @@ logger = logging.getLogger(__name__) def connect_to_site(site_name: str, args: Namespace) -> Site: # connect to site and identify ourselves - logger.info(f"Connecting to {site_name}") + logger.info("Connecting to %s", site_name) try: site = Site(site_name, path=args.path, clients_useragent=wikiget.USER_AGENT) diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py index 49b44ea..deb82a4 100644 --- a/src/wikiget/dl.py +++ b/src/wikiget/dl.py @@ -59,7 +59,9 @@ def process_download(args: Namespace) -> int: # return non-zero exit code if any problems were encountered, even if some # downloads completed successfully logger.warning( - f"{errors} problem{'s'[:errors^1]} encountered during batch processing" + "%i problem%s encountered during batch processing", + errors, + "s"[: errors ^ 1], ) exit_code = 1 # completed with errors else: @@ -88,7 +90,7 @@ def batch_download(args: Namespace) -> int: try: dl_dict = read_batch_file(args.FILE) except OSError as e: - logger.error(f"File could not be read: {e}") + logger.error("File could not be read: %s", str(e)) sys.exit(1) # TODO: validate file contents before download process starts @@ -96,11 +98,11 @@ def batch_download(args: Namespace) -> int: futures = [] for line_num, line in dl_dict.items(): # keep track of batch file line numbers for debugging/logging purposes - logger.info(f"Processing '{line}' at line {line_num}") + logger.info("Processing '%s' at line %i", line, line_num) try: file = prep_download(line, args) except ParseError as e: - logger.warning(f"{e} (line {line_num})") + logger.warning("%s (line %i)", str(e), line_num) errors += 1 continue except FileExistsError as e: @@ -109,7 +111,9 @@ def batch_download(args: Namespace) -> int: continue except (ConnectionError, HTTPError, InvalidResponse, LoginError, APIError): logger.warning( - f"Unable to download '{line}' (line {line_num}) due to an error" + "Unable to download '%s' (line %i) due to an error", + line, + line_num, ) errors += 1 continue diff --git a/src/wikiget/parse.py b/src/wikiget/parse.py index 892f0f0..abe1419 100644 --- a/src/wikiget/parse.py +++ b/src/wikiget/parse.py @@ -65,7 +65,7 @@ def read_batch_file(batch_file: str) -> Dict[int, str]: if batch_file == "-": logger.info("Using stdin for batch download") else: - logger.info(f"Using file '{batch_file}' for batch download") + logger.info("Using file '%s' for batch download", batch_file) with fileinput.input(batch_file) as fd: # read the file into memory and process each line as we go diff --git a/src/wikiget/wikiget.py b/src/wikiget/wikiget.py index db8ebf4..7a2ae08 100644 --- a/src/wikiget/wikiget.py +++ b/src/wikiget/wikiget.py @@ -127,8 +127,8 @@ def cli() -> None: # log events are appended to the file if it already exists, so note the start of a # new download session - logger.info(f"Starting download session using wikiget {wikiget.__version__}") - logger.debug(f"User agent: {wikiget.USER_AGENT}") + logger.info("Starting download session using wikiget %s", wikiget.__version__) + logger.debug("User agent: %s", wikiget.USER_AGENT) exit_code = process_download(args) sys.exit(exit_code) |
