From 0077320bb772cc02593681117f927d6d4a2f7168 Mon Sep 17 00:00:00 2001 From: Michael Poutre Date: Tue, 20 Dec 2022 15:55:31 -0800 Subject: [PATCH] Add server response to pylon debug info for GetServer and PostServer (#85) --- r5dev/networksystem/pylon.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/r5dev/networksystem/pylon.cpp b/r5dev/networksystem/pylon.cpp index f2599e07..5847af8e 100644 --- a/r5dev/networksystem/pylon.cpp +++ b/r5dev/networksystem/pylon.cpp @@ -140,7 +140,16 @@ bool CPylon::GetServerByToken(NetGameServer_t& slOutServer, string& svOutMessage if (pylon_showdebuginfo->GetBool()) { - DevMsg(eDLL_T::ENGINE, "%s - Comp-server replied with '%d'\n", __FUNCTION__, htResult->status); + DevMsg(eDLL_T::ENGINE, "%s - Comp-server replied with status: '%d'\n", __FUNCTION__, htResult->status); + try + { + string jsResultBody = nlohmann::json::parse(htResult->body).dump(4); + DevMsg(eDLL_T::ENGINE, "%s - Comp-Server response body:\n'%s'\n", __FUNCTION__, jsResultBody.c_str()); + } + catch (const std::exception& ex) + { + DevMsg(eDLL_T::ENGINE, "%s - Encountered error parsing Comp-server response body: '%s'\n", __FUNCTION__, ex.what()); + } } try @@ -263,7 +272,16 @@ bool CPylon::PostServerHost(string& svOutMessage, string& svOutToken, const NetG if (htResult && pylon_showdebuginfo->GetBool()) { - DevMsg(eDLL_T::ENGINE, "%s - Comp-server replied with '%d'\n", __FUNCTION__, htResult->status); + DevMsg(eDLL_T::ENGINE, "%s - Comp-server replied with status: '%d'\n", __FUNCTION__, htResult->status); + try + { + string jsResultBody = nlohmann::json::parse(htResult->body).dump(4); + DevMsg(eDLL_T::ENGINE, "%s - Comp-Server response body:\n'%s'\n", __FUNCTION__, jsResultBody.c_str()); + } + catch (const std::exception& ex) + { + DevMsg(eDLL_T::ENGINE, "%s - Encountered error parsing Comp-server response body: '%s'\n", __FUNCTION__, ex.what()); + } } try