refactor: don't use f-string on logging statements
The strings are now be formatted if the logging level is enabled.
This commit is contained in:
parent
c414068c16
commit
861698987c
23 changed files with 94 additions and 84 deletions
|
@ -50,14 +50,14 @@ class PypoFile(Thread):
|
|||
# become an issue here... This needs proper cache management.
|
||||
# https://github.com/libretime/libretime/issues/756#issuecomment-477853018
|
||||
# https://github.com/libretime/libretime/pull/845
|
||||
logger.debug(f"found file {file_id} in cache {dst}, skipping copy...")
|
||||
logger.debug("found file %s in cache %s, skipping copy...", file_id, dst)
|
||||
else:
|
||||
do_copy = True
|
||||
|
||||
media_item["file_ready"] = not do_copy
|
||||
|
||||
if do_copy:
|
||||
logger.info(f"copying file {file_id} to cache {dst}")
|
||||
logger.info("copying file %s to cache %s", file_id, dst)
|
||||
try:
|
||||
with open(dst, "wb") as handle:
|
||||
logger.info(media_item)
|
||||
|
@ -82,7 +82,12 @@ class PypoFile(Thread):
|
|||
|
||||
media_item["file_ready"] = True
|
||||
except Exception as exception:
|
||||
logger.exception(f"could not copy file {file_id} to {dst}: {exception}")
|
||||
logger.exception(
|
||||
"could not copy file %s to %s: %s",
|
||||
file_id,
|
||||
dst,
|
||||
exception,
|
||||
)
|
||||
|
||||
def report_file_size_and_md5_to_api(self, file_path, file_id):
|
||||
try:
|
||||
|
@ -99,7 +104,9 @@ class PypoFile(Thread):
|
|||
except OSError as exception:
|
||||
file_size = 0
|
||||
logger.exception(
|
||||
f"Error getting file size and md5 hash for file id {file_id}: {exception}"
|
||||
"Error getting file size and md5 hash for file id %s: %s",
|
||||
file_id,
|
||||
exception,
|
||||
)
|
||||
|
||||
# Make PUT request to LibreTime to update the file size and hash
|
||||
|
@ -112,7 +119,7 @@ class PypoFile(Thread):
|
|||
except (ConnectionError, Timeout):
|
||||
logger.exception(error_msg)
|
||||
except Exception as exception:
|
||||
logger.exception(f"{error_msg}: {exception}")
|
||||
logger.exception("%s: %s", error_msg, exception)
|
||||
|
||||
return file_size
|
||||
|
||||
|
@ -132,7 +139,7 @@ class PypoFile(Thread):
|
|||
highest_priority = sorted_keys[0]
|
||||
media_item = schedule[highest_priority]
|
||||
|
||||
logger.debug("Highest priority item: %s" % highest_priority)
|
||||
logger.debug("Highest priority item: %s", highest_priority)
|
||||
|
||||
# Remove this media_item from the dictionary. On the next iteration
|
||||
# (from the main function) we won't consider it for prioritization
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue