From ae90b6c93fa8f2446f51e6363020bbac3d69aa7f Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Mon, 14 Apr 2025 18:25:17 -0700 Subject: [PATCH] Add logging to LocalClient (#5827) --- cockatrice/resources/config/qtlogging.ini | 1 + cockatrice/src/server/local_client.cpp | 7 +++++++ cockatrice/src/server/local_client.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/cockatrice/resources/config/qtlogging.ini b/cockatrice/resources/config/qtlogging.ini index 5404c96fb..eeae47b7f 100644 --- a/cockatrice/resources/config/qtlogging.ini +++ b/cockatrice/resources/config/qtlogging.ini @@ -27,6 +27,7 @@ # servers_settings = false # shortcuts_settings = false +# local_client = false # remote_client = false # player = false diff --git a/cockatrice/src/server/local_client.cpp b/cockatrice/src/server/local_client.cpp index b4c1f41ee..4af7a0329 100644 --- a/cockatrice/src/server/local_client.cpp +++ b/cockatrice/src/server/local_client.cpp @@ -1,5 +1,6 @@ #include "local_client.h" +#include "debug_pb_message.h" #include "local_server_interface.h" #include "pb/session_commands.pb.h" @@ -11,6 +12,8 @@ LocalClient::LocalClient(LocalServerInterface *_lsi, { connect(lsi, SIGNAL(itemToClient(const ServerMessage &)), this, SLOT(itemFromServer(const ServerMessage &))); + userName = _playerName; + Command_Login loginCmd; loginCmd.set_user_name(_playerName.toStdString()); loginCmd.set_clientid(_clientId.toStdString()); @@ -27,10 +30,14 @@ LocalClient::~LocalClient() void LocalClient::sendCommandContainer(const CommandContainer &cont) { + qCDebug(LocalClientLog).noquote() << userName << "OUT" << getSafeDebugString(cont); + lsi->itemFromClient(cont); } void LocalClient::itemFromServer(const ServerMessage &item) { + qCDebug(LocalClientLog).noquote() << userName << "IN" << getSafeDebugString(item); + processProtocolItem(item); } diff --git a/cockatrice/src/server/local_client.h b/cockatrice/src/server/local_client.h index 06084b4d4..679d43f2b 100644 --- a/cockatrice/src/server/local_client.h +++ b/cockatrice/src/server/local_client.h @@ -3,6 +3,10 @@ #include "../client/game_logic/abstract_client.h" +#include + +inline Q_LOGGING_CATEGORY(LocalClientLog, "local_client"); + class LocalServerInterface; class LocalClient : public AbstractClient