1 Star 2 Fork 0

lkrkerry/Kristina

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 3.04 KB
一键复制 编辑 原始数据 按行查看 历史
lkrkerry 提交于 2022-04-05 12:10 . 更改架构
#./main.py -- Main File starts from here.
#coding:utf-8
# Import Needs
from utils import log
import os, sys
import inspect
from constants import *
# Init Logging
debuger = log.Logger(os.path.join(LOG_FILE_PATH, "debug/"), level=DEBUG)
infoer = log.Logger(os.path.join(LOG_FILE_PATH, "debug/"))
errorer = log.Logger("&print", level=ERROR)
fataler = log.Logger("&win", level=FATAL)
loggerset = log.LoggerSet(debuger, infoer, errorer, fataler)
# System Info
loggerset.log("Main program started.", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
loggerset.log("Running Path: "+os.getcwd(), ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
loggerset.log("Python Interpretor Version: 3.8 (64-bit)", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
loggerset.log("Python Path: "+str(sys.path), ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
# Security Check
loggerset.log("Starting Self Security Check...", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
try: # Import Security Check
loggerset.log("Try to import Self Security Check...", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
import selfcheck
except Exception as e: # Import Security Check Failed!
loggerset.log(e,level=ERROR, ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
loggerset.log("Security Check module not found!", level=ERROR, ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
loggerset.log("No Security Check has been done... It may be harmful!", level=WARNING, ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
else:
try: # Start Self Check
loggerset.log("Starting Self Check...", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
start = selfcheck.selfcheck(loggerset)
except Exception as e: # Self Check Failed!
loggerset.log(e, level=ERROR, ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
loggerset.log("Self Security Check failed!", level=FATAL, ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
raise
else:
loggerset.log("Self Service Check success!", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
# Start point
loggerset.log("Try to start mainfile startpoint...", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
try:
start(loggerset) # Try to start.
except ModuleNotFoundError:
loggerset.log("No startpoints found!", level=FATAL, ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
raise
except Exception as e:
loggerset.log(e, level=FATAL, ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
print("A fatal error happened...")
print("Please check your ")
raise
# End point
loggerset.log("Main program stopped.", ln=inspect.getframeinfo(inspect.currentframe()).lineno, filename=__file__)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/lkrkerry/Kristina.git
[email protected]:lkrkerry/Kristina.git
lkrkerry
Kristina
Kristina
master

搜索帮助