mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
Add flake8-logging linting (#5620)
* added flake8-logging to make logging more robust * fixed LOG005 warnings * fixed LOG008 warnings * fixed LOG011 warnings * fixed more LOG011 errors * added ignores for intentional logger.error calls * fixed even more LOG011 errors
This commit is contained in:
@ -141,7 +141,7 @@ class LabelConfig(AppConfig):
|
||||
)
|
||||
|
||||
if not dst_dir.exists():
|
||||
logger.info(f"Creating required directory: '{dst_dir}'")
|
||||
logger.info("Creating required directory: '%s'", dst_dir)
|
||||
dst_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Create labels
|
||||
@ -166,15 +166,15 @@ class LabelConfig(AppConfig):
|
||||
# File already exists - let's see if it is the "same"
|
||||
|
||||
if hashFile(dst_file) != hashFile(src_file): # pragma: no cover
|
||||
logger.info(f"Hash differs for '{filename}'")
|
||||
logger.info("Hash differs for '%s'", filename)
|
||||
to_copy = True
|
||||
|
||||
else:
|
||||
logger.info(f"Label template '{filename}' is not present")
|
||||
logger.info("Label template '%s' is not present", filename)
|
||||
to_copy = True
|
||||
|
||||
if to_copy:
|
||||
logger.info(f"Copying label template '{dst_file}'")
|
||||
logger.info("Copying label template '%s'", dst_file)
|
||||
# Ensure destination dir exists
|
||||
dst_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@ -188,7 +188,7 @@ class LabelConfig(AppConfig):
|
||||
except Exception:
|
||||
logger.error(f"Failed to query label for '{filename}' - you should run 'invoke update' first!")
|
||||
|
||||
logger.info(f"Creating entry for {model} '{label['name']}'")
|
||||
logger.info("Creating entry for %s '%s'", model, label['name'])
|
||||
|
||||
try:
|
||||
model.objects.create(
|
||||
@ -201,4 +201,4 @@ class LabelConfig(AppConfig):
|
||||
height=label['height'],
|
||||
)
|
||||
except Exception:
|
||||
logger.warning(f"Failed to create label '{label['name']}'")
|
||||
logger.warning("Failed to create label '%s'", label['name'])
|
||||
|
Reference in New Issue
Block a user