2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-23 15:08:24 +00:00

fix(easy_install): datetime formatting

This commit is contained in:
Gavin D'souza 2020-01-09 12:06:59 +05:30
parent b80cecc917
commit 9cc6e2e2a8

View File

@ -4,12 +4,10 @@ import os, sys, subprocess, getpass, json, multiprocessing, shutil, platform, wa
tmp_bench_repo = os.path.join('/', 'tmp', '.bench') tmp_bench_repo = os.path.join('/', 'tmp', '.bench')
tmp_log_folder = os.path.join('/', 'tmp', 'logs') tmp_log_folder = os.path.join('/', 'tmp', 'logs')
execution_timestamp = datetime.datetime.utcnow()
execution_day = "{:%Y-%m-%d}".format(datetime.datetime.utcnow()) execution_day = "{:%Y-%m-%d}".format(execution_timestamp)
execution_time = "{:%H-%M}".format(datetime.datetime.utcnow()) execution_time = "{:%H:%M}".format(execution_timestamp)
execution_ts = "{0}__{1}".format(execution_day, execution_time) log_file_name = "easy-install__{0}__{1}.log".format(execution_day, execution_time.replace(':', '-'))
log_file_name = "easy-install__{}.log".format(execution_ts)
log_path = os.path.join(tmp_log_folder, log_file_name) log_path = os.path.join(tmp_log_folder, log_file_name)
log_stream = sys.stdout log_stream = sys.stdout
@ -35,7 +33,7 @@ def setup_log_stream(args):
os.makedirs(tmp_log_folder) os.makedirs(tmp_log_folder)
log_stream = open(log_path, 'w') log_stream = open(log_path, 'w')
log("Logs are saved under {0}".format(log_path), level=3) log("Logs are saved under {0}".format(log_path), level=3)
print("Install script run at {}\n\n".format(execution_ts), file=log_stream) print("Install script run at {0} on {1}\n\n".format(execution_time, execution_day), file=log_stream)
def check_environment(): def check_environment():