This commit is contained in:
沈瑗杰 2021-02-14 23:21:25 +08:00
parent 25c56aaeaa
commit 496ccb0580

View File

@ -32,17 +32,14 @@ class Game:
self.dicts = share().dict()
self.lists = share().list()
# logger
logging.basicConfig(filename='logs/%s.log' % (time.time()))
self.log_config = tools.config('configs/logging.json5', 'file')
self.log_filename = 'logs/' + configs.name_handler(
self.log_config['filename']['main'], self.log_config['filename']['formats'])
self.log_file_hander = logging.FileHandler(self.log_filename)
self.log_file_hander.setLevel(tools.log_level(self.log_config['level']))
self.log_stream_hander = logging.StreamHandler()
self.log_stream_hander.setLevel(tools.log_level(self.log_config['level']))
logging.getLogger().addHandler(self.log_stream_hander)
logging.info('logger done')
# logging.getLogger().addHandler(self.log_file_hander)
logging.basicConfig(filename=self.log_filename, level=logging.DEBUG)
self.root_logger_stream_hander = logging.StreamHandler()
self.root_logger_stream_hander.setLevel(
self.log_config['level'])
logging.getLogger().addHandler(self.root_logger_stream_hander)
logging.info('logger done')
self.server_logger = logging.getLogger()
self.client_logger = logging.getLogger()