improve logging

This commit is contained in:
Moritz 2024-10-15 18:04:53 +02:00
parent f877186a57
commit aeccd605ee

View File

@ -134,8 +134,7 @@ def restore(snapshot, target, noninteractive, volumes, container, no_commands):
for container, cmd in list(pre_commands.items()) + list(post_commands.items()):
print(f"\t{container.labels['com.docker.swarm.service.name']}:\t{cmd}")
print(f"This snapshot is {delta} old")
print(
f"THIS COMMAND WILL IRREVERSIBLY OVERWRITES FILES AT {target}")
print("\nTHIS COMMAND WILL IRREVERSIBLY OVERWRITES FILES")
prompt = input("Type YES (uppercase) to continue: ")
if prompt != 'YES':
logger.error("Restore aborted")
@ -209,8 +208,9 @@ def parse_backup_labels(hook_type='backup', selected_container=[]):
post_hooks = settings['post_hooks'] = {}
post_hooks[container] = command
else:
logger.error(
f"Container {s.name} is not running, hooks can not be executed")
logger.debug(f"Container {s.name} is not running.")
if labels.get(f'backupbot.{hook_type}.pre-hook') or labels.get(f'backupbot.{hook_type}.post-hook'):
logger.error(f"Container {s.name} contain hooks but it's not running")
return app_settings
@ -356,8 +356,7 @@ def backup_volumes(backup_paths, apps, retries, dry_run=False):
logger.summary("backup finished", extra=result)
return
except ResticFailedError as error:
logger.error(
f"Backup failed for {apps}. Could not Backup these paths: {backup_paths}")
logger.error(f"Backup failed for {SERVICE}.")
logger.error(error, exc_info=True)
if retries > 0:
retries -= 1