def stop(): if logutils.recording(): try: print "gtklogger recording stopping." logutils.logfile().close() finally: logutils.set_logfile(None)
def start(filename, debugLevel=2, suppress_motion_events=True, logger_comments=True): global _suppress_motion_events logutils.set_debugLevel(debugLevel) _suppress_motion_events = suppress_motion_events if logutils.recording(): #print "gtklogger already recording." logutils.logfile().close() #else: #print "gtklogger recording starting." try: if logger_comments == True: # Open a pipe to the loggergui process for inserting # comments into the output stream. guifile = os.path.abspath(loggergui.__file__) # The third argument of '1' to popen indicates that the # stream is line buffered. This ensures that the comments # appear in the right place. ## TODO 3.1: os.popen is deprecated. Use subprocess.Popen. process = os.popen("python " + guifile + " " + filename, "w", 1) logutils.set_logfile(process) elif type(filename) is types.StringType: logutils.set_logfile(open(filename, "w")) else: # filename is assumed to be a file logutils.set_logfile(filename) except: logutils.set_logfile(None) raise
def start(filename, debugLevel=2, suppress_motion_events=True, logger_comments=True): global _suppress_motion_events logutils.set_debugLevel(debugLevel) _suppress_motion_events = suppress_motion_events if logutils.recording(): logutils.logfile().close() try: if logger_comments: # Open a pipe to the loggergui process for inserting # comments into the output stream. from GUI import loggergui guifile = os.path.abspath(loggergui.__file__) # The third argument of '1' to popen indicates that the # stream is line buffered. This ensures that the comments # appear in the right place. ## TODO: os.popen is deprecated. Use subprocess.Popen. process = os.popen("python " + guifile + " " + filename, "w", 1) logutils.set_logfile(process) elif type(filename) is types.StringType: logutils.set_logfile(open(filename, "w")) else: # filename is assumed to be a file logutils.set_logfile(filename) except: logutils.set_logfile(None) raise
def stop(): if logutils.recording(): try: logutils.logfile().close() finally: logutils.set_logfile(None)