fix logging dupe bug

This commit is contained in:
沈瑗杰 2021-09-22 20:51:30 +08:00
parent 19bb142121
commit 8d732506aa
2 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,7 @@ class Game:
# lang_config # lang_config
self.language = tools.config('configs/sys_value/basic_config.json5') self.language = tools.config('configs/sys_value/basic_config.json5')
self.language = self.language['language'] self.language = self.language['language']
translate.tr.set_language(self.language) tr.set_language(self.language)
# logging config # logging config
log_config = tools.config('configs/logger.json5') log_config = tools.config('configs/logger.json5')
file_name = log_config['handlers']['file']['filename'] file_name = log_config['handlers']['file']['filename']
@ -48,7 +48,7 @@ class Game:
try: try:
logging.config.dictConfig(log_config) logging.config.dictConfig(log_config)
self.logger = logging.getLogger('main') self.logger = logging.getLogger('main')
except ValueError: except ValueError: # it should be no 'logs/' folder
os.mkdir('logs') os.mkdir('logs')
logging.config.dictConfig(log_config) logging.config.dictConfig(log_config)
self.logger = logging.getLogger('main') self.logger = logging.getLogger('main')

View File

@ -35,15 +35,15 @@
'loggers': { 'loggers': {
'client': { 'client': {
'level': 'DEBUG', 'level': 'DEBUG',
'handlers': ['console', 'file'] 'handlers': []
}, },
'server': { 'server': {
'level': 'DEBUG', 'level': 'DEBUG',
'handlers': ['console', 'file'] 'handlers': []
}, },
'main': { 'main': {
'level': 'DEBUG', 'level': 'DEBUG',
'handlers': ['console', 'file'] 'handlers': []
} }
}, },
'root': { 'root': {