修复 ERROR、WARNING 日志重复输出两次的问题

This commit is contained in:
余少琪 2022-02-14 11:40:39 +08:00
parent 5c206e243a
commit 648f47d876
3 changed files with 53 additions and 2 deletions

49
.gitignore vendored Normal file
View File

@ -0,0 +1,49 @@
##ignore this file##
/target/
/.idea/
/.settings/
/.vscode/
/bin/
.classpath
.project
.settings
.idea
##filter databfile、sln file##
*.mdb
*.ldb
*.sln
##class file##
*.com
*.class
*.dll
*.exe
*.o
*.so
# compression file
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.via
*.tmp
*.err
*.log
*.iml
# OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
.factorypath
/.mvn/
/mvnw.cmd
/mvnw

View File

@ -18,7 +18,7 @@ def get_current_system():
class ConfigHandler:
_SLASH = '/'
_SLASH = '\\'
# 判断当前操作系统
if get_current_system() == 'Linux' or get_current_system() == "Darwin":
@ -48,6 +48,8 @@ class ConfigHandler:
error_log_path = os.path.join(root_path, 'logs' + _SLASH + 'error.log')
warning_log_path = os.path.join(root_path, 'logs' + _SLASH + 'warning.log')
if not os.path.exists(report_path):
os.mkdir(report_path)

View File

@ -64,7 +64,7 @@ class LogHandler(object):
INFO = LogHandler(ConfigHandler.info_log_path, level='info')
ERROR = LogHandler(ConfigHandler.error_log_path, level='error')
WARNING = LogHandler(ConfigHandler.error_log_path, level='warning')
WARNING = LogHandler(ConfigHandler.warning_log_path, level='warning')
if __name__ == '__main__':
INFO.logger.info("测试")