Skip to content

Commit

Permalink
xena_dataset.py: Add logging functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
ayan-b committed Jun 17, 2019
1 parent ca957be commit d95d4e4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 53 deletions.
8 changes: 4 additions & 4 deletions xena_gdc_etl/gdc2xena.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def gdc2xena(root_dir, projects, xena_dtypes):
counts = 0
unfinished = {}
total_projects = len(projects)
log_format = '%(asctime)-15s [%(levelname)s]: %(message)s'
log_format = '%(asctime)-15s %(name)s [%(levelname)s]: %(message)s'
logging.basicConfig(
level=logging.WARNING,
level=logging.INFO,
format=log_format,
datefmt='%Y-%m-%d %H:%M:%S',
filename=os.path.join(
Expand Down Expand Up @@ -100,9 +100,9 @@ def gdc2xena(root_dir, projects, xena_dtypes):
json.dump(unfinished, outfile)
msg = 'No {} data for cohort {}.'.format(dtype, project)
logger.warning(msg, exc_info=True)
print(msg)
logging.info(msg)
logging.shutdown()
end_time = timeit.default_timer()
m, s = divmod(int(end_time - start_time), 60)
h, m = divmod(m, 60)
print('Finish in {:d}:{:02d}:{:02d}.'.format(h, m, s))
logging.info('Finish in {:d}:{:02d}:{:02d}.'.format(h, m, s))
Loading

0 comments on commit d95d4e4

Please sign in to comment.