Clean up logging
This commit is contained in:
parent
c78d208e66
commit
4ff0df1b35
|
@ -32,12 +32,9 @@ def main():
|
|||
|
||||
def status(config, containers):
|
||||
"""Outputs the backup config for the compose setup"""
|
||||
|
||||
logger.info("Backup config for compose project '%s'", containers.this_container.project_name)
|
||||
logger.info("Current service: %s", containers.this_container.name)
|
||||
# logger.info("Backup process: %s", containers.backup_process_container.name
|
||||
# if containers.backup_process_container else 'Not Running')
|
||||
logger.info("Backup running: %s", containers.backup_process_running)
|
||||
logger.info("Status for compose project '%s'", containers.this_container.project_name)
|
||||
logger.info("Backup currently running?: %s", containers.backup_process_running)
|
||||
logger.info("%s Detected Config %s", "-" * 25, "-" * 25)
|
||||
|
||||
backup_containers = containers.containers_for_backup()
|
||||
for container in backup_containers:
|
||||
|
@ -51,10 +48,14 @@ def status(config, containers):
|
|||
instance = container.instance
|
||||
ping = instance.ping()
|
||||
logger.info(' - %s (is_ready=%s)', instance.container_type, ping == 0)
|
||||
if ping != 0:
|
||||
logger.error("Database '%s' in service %s cannot be reached", instance.container_type, container.service_name)
|
||||
|
||||
if len(backup_containers) == 0:
|
||||
logger.info("No containers in the project has 'restic-compose-backup.enabled' label")
|
||||
|
||||
logger.info("-" * 67)
|
||||
|
||||
|
||||
def backup(config, containers):
|
||||
"""Request a backup to start"""
|
||||
|
@ -102,7 +103,6 @@ def start_backup_process(config, containers):
|
|||
return
|
||||
|
||||
status(config, containers)
|
||||
logger.info("start-backup-process")
|
||||
|
||||
# Back up volumes
|
||||
try:
|
||||
|
|
|
@ -51,18 +51,18 @@ def ping_postgres(host, port, username, password) -> int:
|
|||
|
||||
def run(cmd: List[str]) -> int:
|
||||
"""Run a command with parameters"""
|
||||
logger.info('cmd: %s', ' '.join(cmd))
|
||||
logger.debug('cmd: %s', ' '.join(cmd))
|
||||
child = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
stdoutdata, stderrdata = child.communicate()
|
||||
|
||||
if stdoutdata:
|
||||
logger.info(stdoutdata.decode().strip())
|
||||
logger.info('-' * 28)
|
||||
logger.debug(stdoutdata.decode().strip())
|
||||
logger.debug('-' * 28)
|
||||
|
||||
if stderrdata:
|
||||
logger.info('%s STDERR %s', '-' * 10, '-' * 10)
|
||||
logger.info(stderrdata.decode().strip())
|
||||
logger.info('-' * 28)
|
||||
logger.error('%s STDERR %s', '-' * 10, '-' * 10)
|
||||
logger.error(stderrdata.decode().strip())
|
||||
logger.error('-' * 28)
|
||||
|
||||
logger.info("returncode %s", child.returncode)
|
||||
logger.debug("returncode %s", child.returncode)
|
||||
return child.returncode
|
||||
|
|
Loading…
Reference in New Issue