diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index 3043b6095..0bf9b4221 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -10838,6 +10838,8 @@ CCreature * CCharacter::startBotChat(BOTCHATTYPE::TBotChatFlags chatType) //----------------------------------------------- void CCharacter::endBotChat(bool newBotChat, bool closeDynChat) { + TLogContext_Item_EndBotChat logContext(_Id); + _TradePagesToUpdate.clear(); if( _ShoppingList != 0 ) diff --git a/code/ryzom/server/src/server_share/log_item_gen.cpp b/code/ryzom/server/src/server_share/log_item_gen.cpp index 853fb303c..07611a489 100644 --- a/code/ryzom/server/src/server_share/log_item_gen.cpp +++ b/code/ryzom/server/src/server_share/log_item_gen.cpp @@ -52,7 +52,7 @@ public: CItemDesc() : _NoContextCount(0) { - _LogDefs.resize(36); + _LogDefs.resize(37); { LGS::TLogDefinition &logDef = _LogDefs[0]; @@ -567,6 +567,15 @@ public: logDef.setContext(true); } + + { + LGS::TLogDefinition &logDef = _LogDefs[36]; + + logDef.setLogName("Item_EndBotChat"); + logDef.setLogText("Bot chat ended. Check why this is causing item log"); + + logDef.setContext(true); + } // Register the log definitions @@ -1252,6 +1261,30 @@ TLogContext_Item_EnchantPhrase::~TLogContext_Item_EnchantPhrase() } +const std::string TLogContext_Item_EndBotChat::_ContextName("Item_EndBotChat"); +/// The constructor push a log context in the logger system +TLogContext_Item_EndBotChat::TLogContext_Item_EndBotChat(const NLMISC::CEntityId &charId) +{ + if (LGS::ILoggerServiceClient::isInitialized()) + LGS::ILoggerServiceClient::getInstance()->pushLogContext(_ContextName); + + // stack the context param in the context class object + ItemDesc.pushContextVar_charId(charId); + +} + +/// The destructor pop a context in the logger system +TLogContext_Item_EndBotChat::~TLogContext_Item_EndBotChat() +{ + if (LGS::ILoggerServiceClient::isInitialized()) + LGS::ILoggerServiceClient::getInstance()->popLogContext(_ContextName); + + // pop the context param in the context class object + ItemDesc.popContextVar_charId(); + +} + + /// No context context. Use this to disable any contextual log underneath TLogNoContext_Item::TLogNoContext_Item() { diff --git a/code/ryzom/server/src/server_share/log_item_gen.h b/code/ryzom/server/src/server_share/log_item_gen.h index 06c59302e..4d1e86ac6 100644 --- a/code/ryzom/server/src/server_share/log_item_gen.h +++ b/code/ryzom/server/src/server_share/log_item_gen.h @@ -413,6 +413,21 @@ private: static const std::string _ContextName; +}; + +struct TLogContext_Item_EndBotChat +{ + /// The constructor push a log context in the logger system + TLogContext_Item_EndBotChat(const NLMISC::CEntityId &charId); + + /// The desstructor pop a context in the logger system + ~TLogContext_Item_EndBotChat(); + +private: + /// The name of the context + static const std::string _ContextName; + + };