From 063e3864d52d42e41b545a6cb8a0c224af1e8206 Mon Sep 17 00:00:00 2001 From: jooleer Date: Wed, 17 May 2023 21:53:02 +0700 Subject: [PATCH] updated logging --- folder_hash_compare.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/folder_hash_compare.py b/folder_hash_compare.py index 32a4946..d2ef69e 100644 --- a/folder_hash_compare.py +++ b/folder_hash_compare.py @@ -107,7 +107,8 @@ def main(): log_name = str(time.time()) logging.basicConfig(filename="logs/log_"+log_name+".txt", level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s', datefmt='%H:%M:%S') print(f"Log file: logs/log_{log_name}.txt\n") - logging.info(f"[SETTINGS] -p {args.primary} -s {args.secondary} -a {args.algorithm} -d {args.disable} -m {args.missing} -n {args.nmissing} -v {args.verbose} -l {args.logging} -c {args.custom}\n") + logging.info(f"[SETTINGS] -p {args.primary} -s {args.secondary} -a {args.algorithm} -d {args.disable} -m {args.missing} -n {args.nmissing} -v {args.verbose} -l {not args.logging} -c {args.custom}") + logging.info(f"Comparing {primary_directory} against {secondary_directory}\n") f1_amount = get_files_amount(primary_directory) f2_amount = get_files_amount(secondary_directory) @@ -180,10 +181,11 @@ def main(): + bcolors.FAIL + f"\n{files_errors} file(s) FAILED" + bcolors.ENDC + bcolors.WARNING + f"\n{files_missing_total} file(s) MISSING" + bcolors.ENDC) - logging.info(f"Processed {files_amount} file(s): ") - logging.info(f"{files_completed} file(s) OK") - logging.info(f"{files_errors} file(s) FAILED") - logging.info(f"{files_missing_total} file(s) MISSING") + if(not args.logging): + logging.info(f"Processed {files_amount} file(s): ") + logging.info(f"{files_completed} file(s) OK") + logging.info(f"{files_errors} file(s) FAILED") + logging.info(f"{files_missing_total} file(s) MISSING") if __name__ == '__main__': @@ -215,7 +217,6 @@ def main(): if(args.verbose): print(f"Comparing:\n{primary_directory}\nagainst:\n{secondary_directory}\n") - logging.info(f"Comparing: {primary_directory} against: {secondary_directory}") # hash algorithm (CRC32, MD5, SHA256) if(not args.algorithm):