Fix about logger web dump

dev-linux
Ivan Maslov 4 years ago
parent add5b0d9cb
commit f4a147d829

@ -327,7 +327,12 @@ def Update(inGSettings):
# v1.1.20 to v1.2.0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Update Structure gSettings["Processor"]
from . import SettingsTemplate
if "Processor" in inGSettings: # Check if Processor exist
# Update Logger
if lL is not None:
SettingsTemplate.LoggerDumpLogHandlerAdd(inLogger=lL, inGSettingsClientDict=inGSettings["Client"])
if lL: lL.warning(f"Backward compatibility (v1.1.20 to v1.2.0): Add web dump log in logger as handler") # Log about compatibility
del inGSettings["Processor"] # Remove the key
if lL: lL.warning(f"Backward compatibility (v1.1.20 to v1.2.0): Remove old structure 'Processor'") # Log about compatibility
if "ProcessorDict" not in inGSettings: # Create new ProcessorDict structure

@ -310,6 +310,22 @@ def __UACClientAdminCreate__():
}
return lResultDict
# Init the log dump to WEB
# import pdb; pdb.set_trace()
############################################
def LoggerDumpLogHandlerAdd(inLogger, inGSettingsClientDict):
lL = inLogger
if len(lL.handlers) == 0:
mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
else:
mRobotLoggerFormatter = lL.handlers[0].formatter
mHandlerDumpLogList = LoggerHandlerDumpLogList.LoggerHandlerDumpLogList(inDict=inGSettingsClientDict,
inKeyStr="DumpLogList", inHashKeyStr="DumpLogListHashStr", inRowCountInt=inGSettingsClientDict[
"DumpLogListCountInt"])
mHandlerDumpLogList.setFormatter(mRobotLoggerFormatter)
lL.addHandler(mHandlerDumpLogList)
# inModeStr:
# "BASIC" - create standart configuration
from pyOpenRPA.Orchestrator.Utils import LoggerHandlerDumpLogList
@ -337,6 +353,7 @@ def Create(inModeStr="BASIC"):
handler.setFormatter(mRobotLoggerFormatter)
mRobotLogger.addHandler(handler)
############################################
LoggerDumpLogHandlerAdd(inLogger=mRobotLogger, inGSettingsClientDict=lResult["Client"])
#mHandlerDumpLogList = LoggerHandlerDumpLogList.LoggerHandlerDumpLogList(inDict=lResult["Client"],
# inKeyStr="DumpLogList",
# inHashKeyStr="DumpLogListHashStr",

@ -855,20 +855,7 @@ def Orchestrator(inGSettings):
inGSettings["VersionStr"] = __version__
#Logger alias
lL = gSettingsDict["Logger"]
# Init the log dump to WEB
#import pdb; pdb.set_trace()
############################################
if len(lL.handlers)== 0:
mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
else:
mRobotLoggerFormatter = lL.handlers[0].formatter
mHandlerDumpLogList = LoggerHandlerDumpLogList.LoggerHandlerDumpLogList(inDict=inGSettings["Client"],
inKeyStr="DumpLogList",
inHashKeyStr="DumpLogListHashStr",
inRowCountInt=inGSettings["Client"]["DumpLogListCountInt"])
mHandlerDumpLogList.setFormatter(mRobotLoggerFormatter)
lL.addHandler(mHandlerDumpLogList)
if lL: lL.info("Link the gSettings in submodules") #Logging
Processor.gSettingsDict = gSettingsDict
Timer.gSettingsDict = gSettingsDict

Loading…
Cancel
Save