From 3f982c221471551734c918d92592f43e0e7fd532 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 20 Nov 2019 09:49:57 +0800 Subject: [PATCH] Shopping list delete doesn't need log, but it should be checked why it's containing items, ryzomclassic/#44, ryzomclassic/#26 --- .../player_manager/character.cpp | 4 +- .../shop_type/character_shopping_list.cpp | 1 + .../server/src/server_share/log_item_gen.cpp | 51 +++++++++---------- .../server/src/server_share/log_item_gen.h | 30 +++++------ 4 files changed, 43 insertions(+), 43 deletions(-) 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 93718ae79..217fe0f24 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 @@ -10149,6 +10149,8 @@ void CCharacter::sellItem( INVENTORIES::TInventory inv, uint32 slot, uint32 quan //----------------------------------------------------------------------------- void CCharacter::itemSolded( uint32 identifier, uint32 quantity, uint32 sellPrice, uint32 basePrice, const CEntityId& buyer, bool sellOffline ) { + // TODO_RYZOMCLASSIC: Log buyer, etc? Item store logging seems lacking. -Kaetemi + TLogContext_Item_SaleStoreSold logContext(_Id); CSmartPtr< IItemTrade > itemTrade = _ItemsInShopStore->removeItem( identifier, quantity, sellOffline ); if( itemTrade != 0 ) { @@ -10840,8 +10842,6 @@ 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/entities_game_service/shop_type/character_shopping_list.cpp b/code/ryzom/server/src/entities_game_service/shop_type/character_shopping_list.cpp index e024334c2..9ff677e10 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/character_shopping_list.cpp +++ b/code/ryzom/server/src/entities_game_service/shop_type/character_shopping_list.cpp @@ -58,6 +58,7 @@ CCharacterShoppingList::CCharacterShoppingList( CSmartPtr& merchant, //----------------------------------------------------------------------------- CCharacterShoppingList::~CCharacterShoppingList() { + TLogNoContext_Item noLog; _CurrentTradeListNpc.clear(); _CurrentTradeListPlayer.clear(); _CurrentTradeListYours.clear(); 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 07611a489..f78b8132e 100644 --- a/code/ryzom/server/src/server_share/log_item_gen.cpp +++ b/code/ryzom/server/src/server_share/log_item_gen.cpp @@ -571,8 +571,8 @@ public: { LGS::TLogDefinition &logDef = _LogDefs[36]; - logDef.setLogName("Item_EndBotChat"); - logDef.setLogText("Bot chat ended. Check why this is causing item log"); + logDef.setLogName("Item_SaleStoreSold"); + logDef.setLogText("An item was sold through the store and money is received"); logDef.setContext(true); } @@ -1005,6 +1005,29 @@ TLogContext_Item_CheckSaleStore::~TLogContext_Item_CheckSaleStore() } +const std::string TLogContext_Item_SaleStoreSold::_ContextName("Item_SaleStoreSold"); +/// The constructor push a log context in the logger system +TLogContext_Item_SaleStoreSold::TLogContext_Item_SaleStoreSold(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_SaleStoreSold::~TLogContext_Item_SaleStoreSold() +{ + if (LGS::ILoggerServiceClient::isInitialized()) + LGS::ILoggerServiceClient::getInstance()->popLogContext(_ContextName); + + // pop the context param in the context class object + ItemDesc.popContextVar_charId(); + +} + const std::string TLogContext_Item_ConsumeAmmo::_ContextName("Item_ConsumeAmmo"); /// The constructor push a log context in the logger system TLogContext_Item_ConsumeAmmo::TLogContext_Item_ConsumeAmmo(const NLMISC::CEntityId &charId) @@ -1261,30 +1284,6 @@ 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 4d1e86ac6..6a549542a 100644 --- a/code/ryzom/server/src/server_share/log_item_gen.h +++ b/code/ryzom/server/src/server_share/log_item_gen.h @@ -248,6 +248,21 @@ private: static const std::string _ContextName; +}; + +struct TLogContext_Item_SaleStoreSold +{ + /// The constructor push a log context in the logger system + TLogContext_Item_SaleStoreSold(const NLMISC::CEntityId &charId); + + /// The desstructor pop a context in the logger system + ~TLogContext_Item_SaleStoreSold(); + +private: + /// The name of the context + static const std::string _ContextName; + + }; struct TLogContext_Item_ConsumeAmmo @@ -413,21 +428,6 @@ 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; - - };