def st_logger(resp,log_path,log_name,verbose=True):
if no_error(resp):
i = 1
log = os.path.join(log_path,'{}.log'.format(log_name))
while os.path.exists(log):
new_log_name = '{} ({}).log'.format(log_name,i)
log = os.path.join(log_path,new_log_name)
i += 1
if verbose: st_print("[+] Output has been written to {}\n".format(log))
with open(log,'w') as l:
l.write(resp)
#http://stackoverflow.com/questions/2828953/silence-the-stdout-of-a-function-in-python-without-trashing-sys-stdout-and-resto
评论列表
文章目录