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.dicts = share().dict()
self.lists = share().list() self.lists = share().list()
# logger # logger
logging.basicConfig(filename='logs/%s.log' % (time.time()))
self.log_config = tools.config('configs/logging.json5', 'file') self.log_config = tools.config('configs/logging.json5', 'file')
self.log_filename = 'logs/' + configs.name_handler( self.log_filename = 'logs/' + configs.name_handler(
self.log_config['filename']['main'], self.log_config['filename']['formats']) self.log_config['filename']['main'], self.log_config['filename']['formats'])
self.log_file_hander = logging.FileHandler(self.log_filename) logging.basicConfig(filename=self.log_filename, level=logging.DEBUG)
self.log_file_hander.setLevel(tools.log_level(self.log_config['level'])) self.root_logger_stream_hander = logging.StreamHandler()
self.log_stream_hander = logging.StreamHandler() self.root_logger_stream_hander.setLevel(
self.log_stream_hander.setLevel(tools.log_level(self.log_config['level'])) self.log_config['level'])
logging.getLogger().addHandler(self.log_stream_hander) logging.getLogger().addHandler(self.root_logger_stream_hander)
logging.info('logger done')
# logging.getLogger().addHandler(self.log_file_hander)
logging.info('logger done') logging.info('logger done')
self.server_logger = logging.getLogger() self.server_logger = logging.getLogger()
self.client_logger = logging.getLogger() self.client_logger = logging.getLogger()