def writeToLog(dmode, out): """ singleton handler for the log file @param dmode: E, W, S, H, A, C, I @param out: message string @return: none """ if config.plugins.dreamplex.writeDebugFile.value: try: instance = Singleton() if instance.getLogFileInstance() is "": openLogFile() gLogFile = instance.getLogFileInstance() gLogFile.truncate() else: gLogFile = instance.getLogFileInstance() now = datetime.datetime.now() gLogFile.write("%02d:%02d:%02d.%07d " % (now.hour, now.minute, now.second, now.microsecond) + " >>> " + str( dmode) + " <<< " + str(out) + "\n") gLogFile.flush() except Exception, ex: config.plugins.dreamplex.writeDebugFile.value = False config.plugins.dreamplex.debugMode.save() printl2("Exception(" + str(type(ex)) + "): " + str(ex), "__common__::writeToLog", "E")
def writeToLog(dmode, out): ''' singleton handler for the log file @param dmode: E, W, S, H, A, C, I @param out: message string @return: none ''' try: #======================================================================= # if gLogFile is None: # openLogFile() #======================================================================= instance = Singleton() if instance.getLogFileInstance() is "": openLogFile() gLogFile = instance.getLogFileInstance() gLogFile.truncate() else: gLogFile = instance.getLogFileInstance() now = datetime.datetime.now() gLogFile.write("%02d:%02d:%02d.%07d " % (now.hour, now.minute, now.second, now.microsecond) + " >>> " + str(dmode) + " <<< " + str(out) + "\n") gLogFile.flush() except Exception, ex: printl2("Exception(" + str(type(ex)) + "): " + str(ex), "__common__::writeToLog", "E")
def writeToLog(dmode, out): """ singleton handler for the log file @param dmode: E, W, S, H, A, C, I @param out: message string @return: none """ try: # ======================================================================= # if gLogFile is None: # openLogFile() # ======================================================================= instance = Singleton() if instance.getLogFileInstance() is "": openLogFile() gLogFile = instance.getLogFileInstance() gLogFile.truncate() else: gLogFile = instance.getLogFileInstance() now = datetime.datetime.now() gLogFile.write( "%02d:%02d:%02d.%07d " % (now.hour, now.minute, now.second, now.microsecond) + " >>> " + str(dmode) + " <<< " + str(out) + "\n" ) gLogFile.flush() except Exception, ex: printl2("Exception(" + str(type(ex)) + "): " + str(ex), "__common__::writeToLog", "E")
def openLogFile(): ''' singleton instance for logfile @param: none @return: none ''' #printl2("", "openLogFile", "S") logDir = config.plugins.dreamplex.logfolderpath.value now = datetime.datetime.now() try: if os.path.exists(logDir + "dreamplex_former.log"): os.remove(logDir + "dreamplex_former.log") if os.path.exists(logDir + "dreamplex.log"): shutil.copy2(logDir + "dreamplex.log", logDir + "dreamplex_former.log") instance = Singleton() instance.getLogFileInstance(open(logDir + "dreamplex.log", "w")) except Exception, ex: printl2("Exception(" + str(type(ex)) + "): " + str(ex), "openLogFile", "E")
def openLogFile(): """ singleton instance for logfile @param: none @return: none """ # printl2("", "openLogFile", "S") logDir = config.plugins.dreamplex.logfolderpath.value now = datetime.datetime.now() try: instance = Singleton() instance.getLogFileInstance(open(logDir + "dreamplex.log", "w")) except Exception, ex: printl2("Exception(" + str(type(ex)) + "): " + str(ex), "openLogFile", "E")
def openLogFile(): """ singleton instance for logfile """ #printl2("", "openLogFile", "S") logDir = config.plugins.dreamplex.logfolderpath.value try: if os.path.exists(logDir + "dreamplex_former.log"): os.remove(logDir + "dreamplex_former.log") if os.path.exists(logDir + "dreamplex.log"): shutil.copy2(logDir + "dreamplex.log", logDir + "dreamplex_former.log") instance = Singleton() instance.getLogFileInstance(open(logDir + "dreamplex.log", "w")) except Exception, ex: printl2("Exception(" + str(type(ex)) + "): " + str(ex), "openLogFile", "E")