def parse_log(string): info = IJ.getLog() parse_output = {} parsed_lines = [line for line in info.splitlines() if string in line] for line in parsed_lines: key, value = line.split(' = ') parse_output[key] = value return parse_output
def get_log_results(filepath): #Get log information. log_results = IJ.getLog() log_table = str(log_results).split("\n") log_final = log_ls + log_table with open(filepath, 'w') as f: for item in log_final: f.write("%s\n" % item)
def saveIJLog(path): f = None try: f = open(path, "w") logText = IJ.getLog() if logText is not None: f.write(logText) except: print("ERR: Could not save IJ log file!") finally: if f is not None: f.close()
def saveLogs(self): try: log = IJ.getLog() #change the below line to f=open(join(self.downloadsFolder,"logs.txt"),'a') #for one log file to rule them all...it will append all logs to one file. f = open(join(self.downloadsFolder, self.uniqueID + " logs.txt"), 'w') f.write(log) print("saved the log.") except: print("no speckles.") finally: f.close()