From 72082fc4094844d2a04c73f08c334fe367aa3fb7 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 9 Jan 2022 17:15:59 -0800 Subject: [PATCH] Add source object name to Object message log --- Runtime/CStateManager.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 8c015ab19..99f062b9d 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -1330,8 +1330,14 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes } if (m_logScripting) { - LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), - dest->GetName(), dest->GetUniqueId()); + auto srcObj = GetObjectById(src); + if (srcObj != nullptr) { + LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(), + ScriptObjectMessageToStr(msg), dest->GetName(), dest->GetUniqueId(), src, dest->GetUniqueId()); + } else { + LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), + dest->GetName(), dest->GetUniqueId()); + } } dest->AcceptScriptMsg(msg, src, *this); @@ -1349,8 +1355,14 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb } if (m_logScripting) { - LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), - dst->GetName(), dst->GetUniqueId()); + auto srcObj = GetObjectById(src); + if (srcObj != nullptr) { + LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(), + ScriptObjectMessageToStr(msg), dst->GetName(), dst->GetUniqueId(), src, dst->GetUniqueId()); + } else { + LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg), + dst->GetName(), dst->GetUniqueId()); + } } dst->AcceptScriptMsg(msg, src, *this);