mirror of
https://gitlab.os-k.eu/neox/CNIRevelator.git
synced 2023-08-25 14:03:10 +02:00
Update CNI_Revelator.py
This commit is contained in:
parent
1bd27fb59a
commit
65af6274b3
@ -25,22 +25,23 @@ if not os.path.exists(CST_FOLDER):
|
|||||||
print("pass IO ERROR")
|
print("pass IO ERROR")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
import logging
|
print("debug")
|
||||||
from logging import FileHandler
|
import logging
|
||||||
logger = logging.getLogger()
|
from logging import FileHandler
|
||||||
logger.setLevel(logging.INFO)
|
logger = logging.getLogger()
|
||||||
formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
|
logger.setLevel(logging.INFO)
|
||||||
error_handler = FileHandler((CST_FOLDER + '\\error.log'), mode='w', encoding='utf-8', delay=True)
|
formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
|
||||||
info_handler = FileHandler((CST_FOLDER + '\\cnirevelator.log'), mode='w', encoding='utf-8')
|
error_handler = FileHandler((CST_FOLDER + '\\error.log'), mode='w', encoding='utf-8', delay=True)
|
||||||
error_handler.setLevel(logging.ERROR)
|
info_handler = FileHandler((CST_FOLDER + '\\cnirevelator.log'), mode='w', encoding='utf-8')
|
||||||
logger.addHandler(error_handler)
|
error_handler.setLevel(logging.ERROR)
|
||||||
info_handler.setLevel(logging.DEBUG)
|
logger.addHandler(error_handler)
|
||||||
info_handler.setFormatter(formatter)
|
info_handler.setLevel(logging.DEBUG)
|
||||||
logger.addHandler(info_handler)
|
info_handler.setFormatter(formatter)
|
||||||
from CNI_classes import *
|
logger.addHandler(info_handler)
|
||||||
from CNI_Update import *
|
from CNI_classes import *
|
||||||
|
from CNI_Update import *
|
||||||
|
|
||||||
def main(logger):
|
def main(logger):
|
||||||
logger.error('')
|
logger.error('')
|
||||||
logger.info('main() : **** Creating App_main() ****')
|
logger.info('main() : **** Creating App_main() ****')
|
||||||
main_w = App_main(logger)
|
main_w = App_main(logger)
|
||||||
@ -63,32 +64,32 @@ if not os.path.exists(CST_FOLDER):
|
|||||||
logger.info('main() : **** Ending App_main() ****')
|
logger.info('main() : **** Ending App_main() ****')
|
||||||
|
|
||||||
|
|
||||||
logger.info('launcher : ' + CST_NAME + ' ' + CST_VER)
|
logger.info('launcher : ' + CST_NAME + ' ' + CST_VER)
|
||||||
logger.info('launcher : *****Hello World*****')
|
logger.info('launcher : *****Hello World*****')
|
||||||
logger.info('launcher : *****Launching SoftUpdate()*****')
|
logger.info('launcher : *****Launching SoftUpdate()*****')
|
||||||
try:
|
try:
|
||||||
Answer = SoftUpdate(logger)
|
Answer = SoftUpdate(logger)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info('launcher : *****FATAL ERROR*****' + str(e))
|
logger.info('launcher : *****FATAL ERROR*****' + str(e))
|
||||||
os.abort()
|
os.abort()
|
||||||
|
|
||||||
logger.info('launcher : *****Ending SoftUpdate()*****')
|
logger.info('launcher : *****Ending SoftUpdate()*****')
|
||||||
try:
|
try:
|
||||||
if Answer == True:
|
if Answer == True:
|
||||||
logger.info('launcher : *****Launching main()*****')
|
logger.info('launcher : *****Launching main()*****')
|
||||||
State = main(logger)
|
State = main(logger)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info('launcher : *****FATAL ERROR*****' + str(e))
|
logger.info('launcher : *****FATAL ERROR*****' + str(e))
|
||||||
os.abort()
|
os.abort()
|
||||||
|
|
||||||
logger.info('launcher : *****Ending main()*****')
|
logger.info('launcher : *****Ending main()*****')
|
||||||
logger.info('launcher : *****Goodbye!*****')
|
logger.info('launcher : *****Goodbye!*****')
|
||||||
handlers = logger.handlers[:]
|
handlers = logger.handlers[:]
|
||||||
for handler in handlers:
|
for handler in handlers:
|
||||||
handler.close()
|
handler.close()
|
||||||
logger.removeHandler(handler)
|
logger.removeHandler(handler)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(CST_FOLDER + '\\error.log') as (echo):
|
with open(CST_FOLDER + '\\error.log') as (echo):
|
||||||
try:
|
try:
|
||||||
os.remove('error.log')
|
os.remove('error.log')
|
||||||
@ -99,8 +100,8 @@ if not os.path.exists(CST_FOLDER):
|
|||||||
temptwo = str(echo.read())
|
temptwo = str(echo.read())
|
||||||
if len(temptwo) != 1:
|
if len(temptwo) != 1:
|
||||||
copyfile(CST_FOLDER + '\\cnirevelator.log', 'error.log')
|
copyfile(CST_FOLDER + '\\cnirevelator.log', 'error.log')
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
print("exit")
|
print("exit")
|
||||||
#sys.exit(0)
|
#sys.exit(0)
|
Loading…
Reference in New Issue
Block a user