Config packetlog
This commit is contained in:
@@ -10,6 +10,7 @@ from game_server.game.player.player_manager import PlayerManager
|
||||
from game_server.dummy import dummyprotolist
|
||||
import traceback
|
||||
from utils.time import cur_timestamp_ms
|
||||
from utils.config import Config
|
||||
|
||||
class PlayerSession:
|
||||
def __init__(self, transport, session_id, client_addr, db):
|
||||
@@ -94,14 +95,16 @@ class PlayerSession:
|
||||
if not handle_result:
|
||||
return
|
||||
except ModuleNotFoundError:
|
||||
Error(f"Unhandled request {request_name}")
|
||||
if Config.PacketLog:
|
||||
Error(f"Unhandled request {request_name}")
|
||||
return
|
||||
except Exception:
|
||||
Error(f"Handler {request_name} returns error.")
|
||||
traceback.print_exc()
|
||||
return
|
||||
|
||||
Info(f"Received cmd: {request_name}({cmd_id})")
|
||||
|
||||
if Config.PacketLog:
|
||||
Info(f"Received cmd: {request_name}({cmd_id})")
|
||||
|
||||
response_name = handle_result.__class__.__name__
|
||||
cmd_type = getattr(cmd.CmdID, response_name, None)
|
||||
@@ -136,7 +139,8 @@ class PlayerSession:
|
||||
self.kcp.flush()
|
||||
cmd_id = packet.cmd_type
|
||||
request_name = cmd.get_key_by_value(cmd_id)
|
||||
Info(f"Sent cmd: {request_name}({cmd_id})")
|
||||
if Config.PacketLog:
|
||||
Info(f"Sent cmd: {request_name}({cmd_id})")
|
||||
|
||||
def time(self):
|
||||
return (cur_timestamp_ms()) - self.connect_time_ms
|
||||
|
||||
Reference in New Issue
Block a user