Use % formatting in log messages over f-strings
This commit is contained in:
parent
f33cf3c8a9
commit
6c87f3dac1
@ -34,7 +34,7 @@ def rsync(*args):
|
||||
"""
|
||||
cmd = [_RSYNC_BIN, *args]
|
||||
|
||||
syslog.debug(f"rsync command: {cmd}")
|
||||
syslog.debug("rsync command: %s", cmd)
|
||||
syslog.info("Beginning rsync process")
|
||||
|
||||
process = subprocess.run(cmd, capture_output=True, check=True, text=True)
|
||||
|
@ -75,6 +75,6 @@ def do_backup(repository, parsed_config, args, extra_rsync_opts=None):
|
||||
exit(E_INVALID_SNAPSHOT_NAME)
|
||||
except CalledProcessError as e:
|
||||
syslog.critical("Backup process failed")
|
||||
syslog.critical(f"Failing command: {e.cmd}")
|
||||
syslog.critical("Failing command: %s", e.cmd)
|
||||
syslog.critical(e.stderr)
|
||||
exit(e.returncode)
|
||||
|
@ -101,7 +101,7 @@ class Hierarchy(os.PathLike):
|
||||
def cleanup(self, **kwargs):
|
||||
"""Clean up this Hierarchy's data from the filesystem."""
|
||||
|
||||
syslog.info(f"Performing cleanup on {self._path}")
|
||||
syslog.info("Performing cleanup on %s", self._path)
|
||||
|
||||
# We don't want to risk symlink attacks
|
||||
# noinspection PyUnresolvedReferences
|
||||
@ -119,7 +119,7 @@ class Hierarchy(os.PathLike):
|
||||
|
||||
:rtype: type that the data is serialized as
|
||||
"""
|
||||
syslog.debug(f"Reading metadata from {self.metadata_path}")
|
||||
syslog.debug("Reading metadata from %s", self.metadata_path)
|
||||
with self.metadata_path.open(mode=METADATA_READ) as mfile:
|
||||
return json.load(mfile)
|
||||
|
||||
@ -131,7 +131,7 @@ class Hierarchy(os.PathLike):
|
||||
:param attr: class data to write to file
|
||||
:type attr: any type
|
||||
"""
|
||||
syslog.debug(f"Writing metadata to {self.metadata_path}")
|
||||
syslog.debug("Writing metadata to %s", self.metadata_path)
|
||||
|
||||
tmpfile = self.metadata_path.with_suffix(".tmp")
|
||||
|
||||
|
@ -232,7 +232,7 @@ class Repository(Hierarchy):
|
||||
self.metadata_path.unlink()
|
||||
self.snapshot_symlink.unlink()
|
||||
syslog.info("Removing repository metadata")
|
||||
syslog.debug(f"Repository metadata removed: {self.metadata_path}")
|
||||
syslog.debug("Repository metadata removed: %s", self.metadata_path)
|
||||
|
||||
if remove_snapshots:
|
||||
try:
|
||||
@ -248,7 +248,7 @@ class Repository(Hierarchy):
|
||||
except PermissionError as e:
|
||||
syslog.error(e)
|
||||
else:
|
||||
syslog.info(f"Removed repository directory: {self.path}")
|
||||
syslog.info("Removed repository directory: %s", self.path)
|
||||
|
||||
def create_snapshot(self, name=None):
|
||||
"""Create a new snapshot in this repository.
|
||||
@ -295,7 +295,7 @@ class Repository(Hierarchy):
|
||||
self.write_metadata(self._snapshot_metadata)
|
||||
|
||||
syslog.debug("Snapshot created")
|
||||
syslog.debug(f"Snapshot name: {new_snapshot.name}")
|
||||
syslog.debug("Snapshot name: %s", new_snapshot.name)
|
||||
|
||||
self.symlink_snapshot(new_snapshot)
|
||||
return new_snapshot
|
||||
|
Loading…
x
Reference in New Issue
Block a user