Skip to content
Snippets Groups Projects
Commit fae7fd75 authored by ferrari's avatar ferrari
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
import git
import json
import os
import datetime
import __main__
def log_info(args, path=None):
time = datetime.time()
if path:
if '/' in path:
os.makedirs(path.rsplit('/', 1)[0], exist_ok=True)
else:
if not os.path.isdir('run_log'):
os.makedirs('run_log')
path = 'run_log/' + time.isoformat() + '.json'
with open(path, 'w') as logfile:
repo = git.Repo(os.path.dirname(os.path.abspath(__main__.__file__)), search_parent_directories=True)
sha = repo.head.object.hexsha
json.dump({'script': __main__.__file__,
'commit': sha,
'parameters': args,
'time': time}, logfile)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment