From df4af8751a5c1e1465159083100b82e58e7778f7 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Mon, 5 Aug 2024 14:44:44 +0800 Subject: Update write_log_file() so that it put the most recent message on the top; remove duplicate write_log_file() --- Code/backup_files.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'Code/backup_files.py') diff --git a/Code/backup_files.py b/Code/backup_files.py index 6105525..0b044f1 100644 --- a/Code/backup_files.py +++ b/Code/backup_files.py @@ -9,21 +9,10 @@ import os, sys from configure import UPDATE_NETWORK_LOG_FILE from datetime import datetime +from log import write_log_file MINIMUM_SPACE_REQUIREMENT = 1 # Gigabytes -def write_log_file(s, fname): - if not os.path.exists(fname): - return None - f = open(fname, 'a') - curr_time = datetime.now().strftime('%Y-%m-%d %H:%M') - s = '[' + curr_time + ']: ' + s - if not '\n' in s: - s += '\n' - f.write(s) - f.close() - - def make_paths(s): if not os.path.isdir(s): os.makedirs(s) -- cgit v1.2.1