diff --git a/borgmatic/borg/create.py b/borgmatic/borg/create.py index 523ab6e8..09039bea 100644 --- a/borgmatic/borg/create.py +++ b/borgmatic/borg/create.py @@ -187,13 +187,7 @@ def create_archive( + (('--info',) if logger.getEffectiveLevel() == logging.INFO and not json else ()) + ( ('--stats',) - if not dry_run - and ( - (logger.isEnabledFor(logging.INFO) and files) - or logger.isEnabledFor(logging.DEBUG) - or stats - ) - and not json + if not dry_run and (logger.isEnabledFor(logging.DEBUG) or stats) and not json else () ) + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) and not json else ()) @@ -217,7 +211,7 @@ def create_archive( if json: output_log_level = None - elif stats: + elif stats and logger.getEffectiveLevel() == logging.WARNING: output_log_level = logging.WARNING else: output_log_level = logging.INFO diff --git a/borgmatic/borg/prune.py b/borgmatic/borg/prune.py index 5d8610bb..f3f17c0c 100644 --- a/borgmatic/borg/prune.py +++ b/borgmatic/borg/prune.py @@ -60,10 +60,7 @@ def prune_archives( + (('--lock-wait', str(lock_wait)) if lock_wait else ()) + ( ('--stats',) - if not dry_run - and (logger.isEnabledFor(logging.INFO) and files) - or logger.getEffectiveLevel() == logging.DEBUG - or stats + if not dry_run and logger.getEffectiveLevel() == logging.DEBUG or stats else () ) + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) @@ -76,6 +73,8 @@ def prune_archives( execute_command( full_command, - output_log_level=logging.WARNING if stats else logging.INFO, + output_log_level=logging.WARNING + if (stats and logger.getEffectiveLevel() == logging.WARNING) + else logging.INFO, error_on_warnings=False, )