mirror of
https://gitlab.os-k.eu/neox/CNIRevelator.git
synced 2023-08-25 14:03:10 +02:00
Integrating the analyzer
This commit is contained in:
parent
a5deec0076
commit
54443577ca
@ -38,7 +38,9 @@ import pytesseract # pytesseract.py
|
||||
## MAIN FUNCTION OF CNIREVELATOR
|
||||
def main():
|
||||
import logger # logger.py
|
||||
logfile = logger.logMain
|
||||
logfile = logger.logCur
|
||||
|
||||
logfile.printdbg('*** CNIRevelator LOGFILE. Hello World ! ***')
|
||||
|
||||
try:
|
||||
os.environ['PATH'] = globs.CNIRFolder + '\\Tesseract-OCR4\\'
|
||||
@ -58,6 +60,9 @@ def main():
|
||||
main_w.mainloop()
|
||||
logger.info('main() : **** Ending App_main() ****')
|
||||
|
||||
logfile.printdbg('*** CNIRevelator LOGFILE. Goodbye World ! ***')
|
||||
logfile.close()
|
||||
|
||||
|
||||
## BOOTSTRAP OF CNIREVELATOR
|
||||
|
||||
|
@ -40,7 +40,6 @@ CNIRNewVersion = False
|
||||
|
||||
CNIRConfig = CNIRFolder + '\\config\\conf.ig'
|
||||
CNIRErrLog = CNIRFolder + '\\logs\\error.log'
|
||||
CNIRLauncherLog = CNIRFolder + '\\logs\\launcher.log'
|
||||
CNIRMainLog = CNIRFolder + '\\logs\\main.log'
|
||||
CNIRUrlConfig = CNIRFolder + '\\config\\urlconf.ig'
|
||||
CNIRVerStock = CNIRFolder + '\\downloads\\versions.lst'
|
||||
|
@ -53,5 +53,4 @@ def lmain(mainThread):
|
||||
launcherWindow.mainloop()
|
||||
|
||||
logfile.printdbg('*** CNIRLauncher LOGFILE. Goodbye World ! ***')
|
||||
logfile.close()
|
||||
return
|
||||
|
@ -44,33 +44,6 @@ class NewLoggingSystem:
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO) # To make sure we can have a debug channel
|
||||
|
||||
# Create channels
|
||||
formatter = logging.Formatter("\n[ %(module)s/%(funcName)s ] %(asctime)s :: %(levelname)s :: %(message)s")
|
||||
error_handler = logging.FileHandler((globs.CNIRErrLog), mode='w', encoding='utf-8', delay=True)
|
||||
info_handler = logging.FileHandler((globs.CNIRLauncherLog), mode='w', encoding='utf-8')
|
||||
|
||||
error_handler.setLevel(logging.ERROR)
|
||||
error_handler.setFormatter(formatter)
|
||||
logger.addHandler(error_handler)
|
||||
|
||||
info_handler.setLevel(logging.DEBUG)
|
||||
info_handler.setFormatter(formatter)
|
||||
logger.addHandler(info_handler)
|
||||
|
||||
self.logger = logger
|
||||
self.printerr = logger.error
|
||||
self.printdbg = logger.info
|
||||
|
||||
def close(self):
|
||||
logging.shutdown()
|
||||
|
||||
class NewMainLoggingSystem:
|
||||
|
||||
def __init__(self):
|
||||
# Create new logging handle
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO) # To make sure we can have a debug channel
|
||||
|
||||
# Create channels
|
||||
formatter = logging.Formatter("\n[ %(module)s/%(funcName)s ] %(asctime)s :: %(levelname)s :: %(message)s")
|
||||
error_handler = logging.FileHandler((globs.CNIRErrLog), mode='w', encoding='utf-8', delay=True)
|
||||
@ -91,6 +64,10 @@ class NewMainLoggingSystem:
|
||||
def close(self):
|
||||
logging.shutdown()
|
||||
|
||||
handlers = self.logger.handlers[:]
|
||||
for handler in handlers:
|
||||
handler.close()
|
||||
self.logger.removeHandler(handler)
|
||||
|
||||
## Global Handler
|
||||
logCur = NewLoggingSystem()
|
||||
logMain = NewMainLoggingSystem()
|
||||
|
Loading…
Reference in New Issue
Block a user