def log_error(step, content):
'''
This function logs a page for error.
It is called whenever an unhandled exception will occur.
`step`: The step in login process, it could be normal_login, step_two_login or
select_alternate.
It makes it easy to identify the file in logs.
`content`: content to log.
'''
file_name = step + "- " + time.strftime("%d-%m-%Y %H-%M-%S") + ".html"
f = open(log_dir+file_name, 'w')
f.write(content)
f.close()
# hostname of the machine where the py-google-auth is running
hostname = platform.node()
return file_name, hostname
评论列表
文章目录