def log(args, kwargs):
logfile = os.path.join(args.logdir, '<STR_LIT>')<EOL>if '<STR_LIT>' not in globals():<EOL><INDENT>if os.path.exists(logfile):<EOL><INDENT>logging.error('<STR_LIT>', logfile)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>global log_created<EOL>log_created = sorted(kwargs.keys())<EOL>header = '<STR_LIT:\t>'.join((str(k) for k in log_created)) + '<STR_LIT:\n>'<EOL>with open(logfile, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(header)<EOL><DEDENT><DEDENT>assert log_created == sorted(kwargs.keys())<EOL>with open(logfile, '<STR_LIT:a>') as f:<EOL><INDENT>f.write('<STR_LIT:\t>'.join((str(kwargs[k]) for k in log_created)) + '<STR_LIT:\n>')<EOL><DEDENT>
Log to a file.