From feac4c05981852b6b7678a6162420d1a72c493ab Mon Sep 17 00:00:00 2001 From: Exynox Date: Sun, 7 Jan 2024 22:05:51 +0200 Subject: [PATCH] Applied changes on the db executable. Removed old logging functions. Various global changes. --- src/common/utils.h | 5 + src/db/CMakeLists.txt | 4 - src/db/src/AuctionManager.cpp | 42 +- src/db/src/BlockCountry.cpp | 14 +- src/db/src/Cache.cpp | 23 +- src/db/src/ClientManager.cpp | 652 ++++++++++++-------------- src/db/src/ClientManagerBoot.cpp | 114 ++--- src/db/src/ClientManagerEventFlag.cpp | 6 +- src/db/src/ClientManagerGuild.cpp | 40 +- src/db/src/ClientManagerLogin.cpp | 38 +- src/db/src/ClientManagerParty.cpp | 32 +- src/db/src/ClientManagerPlayer.cpp | 91 ++-- src/db/src/Config.cpp | 2 +- src/db/src/DBManager.cpp | 2 +- src/db/src/GuildManager.cpp | 126 ++--- src/db/src/HB.cpp | 6 +- src/db/src/ItemAwardManager.cpp | 6 +- src/db/src/ItemIDRangeManager.cpp | 8 +- src/db/src/ItemIDRangeManager.h | 14 +- src/db/src/LoginData.cpp | 4 +- src/db/src/Main.cpp | 58 +-- src/db/src/Marriage.cpp | 36 +- src/db/src/Monarch.cpp | 16 +- src/db/src/Peer.cpp | 24 +- src/db/src/PeerBase.cpp | 18 +- src/db/src/PrivManager.cpp | 12 +- src/db/src/ProtoReader.cpp | 12 +- src/db/src/stdafx.h | 2 - src/game/CMakeLists.txt | 4 - src/game/src/dragon_soul_table.cpp | 2 +- src/game/src/input_main.cpp | 2 +- src/game/src/item_manager.cpp | 19 +- src/game/src/main.cpp | 4 +- src/game/src/questmanager.cpp | 2 +- src/game/src/stdafx.h | 2 - src/libsql/src/CAsyncSQL.cpp | 54 +-- src/libsql/src/CStatement.cpp | 10 +- src/libthecore/CMakeLists.txt | 8 + src/libthecore/include/log.h | 45 +- src/libthecore/include/stdafx.h | 3 + src/libthecore/include/utils.h | 2 +- src/libthecore/src/buffer.cpp | 14 +- src/libthecore/src/heart.cpp | 12 +- src/libthecore/src/log.cpp | 436 +---------------- src/libthecore/src/main.cpp | 7 +- src/libthecore/src/utils.cpp | 14 +- 46 files changed, 748 insertions(+), 1299 deletions(-) diff --git a/src/common/utils.h b/src/common/utils.h index 9069c90..251b6fb 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -1,3 +1,6 @@ +#ifndef __INC_METIN2_UTILS_H__ +#define __INC_METIN2_UTILS_H__ + /*----- atoi function -----*/ inline bool str_to_number (bool& out, const char *in) { @@ -72,3 +75,5 @@ inline bool str_to_number (float& out, const char *in) } /*----- atoi function -----*/ + +#endif diff --git a/src/db/CMakeLists.txt b/src/db/CMakeLists.txt index 9fe330f..f9d0bae 100644 --- a/src/db/CMakeLists.txt +++ b/src/db/CMakeLists.txt @@ -33,10 +33,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE effolkronium_random) find_package(fmt CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) -# spdlog -find_package(spdlog CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog) - # # System-provided dependencies # diff --git a/src/db/src/AuctionManager.cpp b/src/db/src/AuctionManager.cpp index 699e3e8..a28bb3e 100644 --- a/src/db/src/AuctionManager.cpp +++ b/src/db/src/AuctionManager.cpp @@ -406,13 +406,13 @@ AuctionResult AuctionManager::EnrollInAuction(CItemCache* item_cache, TAuctionIt CItemCache* c = GetItemCache (item_info.item_id); if (c != NULL) { - sys_err ("item id : %d is already in AuctionManager", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in AuctionManager", item_info.item_id); return AUCTION_FAIL; } if (!Auction.InsertItemInfo (&item_info)) { - sys_err ("item id : %d is already in AuctionBoard", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in AuctionBoard", item_info.item_id); return AUCTION_FAIL; } @@ -429,19 +429,19 @@ AuctionResult AuctionManager::EnrollInSale(CItemCache* item_cache, TSaleItemInfo CItemCache* c = GetItemCache (item_info.item_id); if (c != NULL) { - sys_err ("item id : %d is already in AuctionManager", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in AuctionManager", item_info.item_id); return AUCTION_FAIL; } if (!Wish.GetItemInfoCache (WishBoard::Key (item_info.item_num, item_info.wisher_id))) { - sys_err ("item_num : %d, wisher_id : %d is not in wish auction.", item_info.item_num, item_info.wisher_id); + SPDLOG_ERROR("item_num : {}, wisher_id : {} is not in wish auction.", item_info.item_num, item_info.wisher_id); return AUCTION_FAIL; } if (!Sale.InsertItemInfo (&item_info)) { - sys_err ("item id : %d is already in SaleBoard", item_info.item_id); + SPDLOG_ERROR("item id : {} is already in SaleBoard", item_info.item_id); return AUCTION_FAIL; } @@ -457,7 +457,7 @@ AuctionResult AuctionManager::EnrollInWish(TWishItemInfo &item_info) { if (!Wish.InsertItemInfo (&item_info)) { - sys_err ("wisher_id : %d, item_num : %d is already in WishBoard", item_info.offer_id, item_info.item_num); + SPDLOG_ERROR("wisher_id : {}, item_num : {} is already in WishBoard", item_info.offer_id, item_info.item_num); return AUCTION_FAIL; } @@ -469,7 +469,7 @@ AuctionResult AuctionManager::Bid(DWORD bidder_id, const char* bidder_name, DWOR CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } @@ -506,7 +506,7 @@ AuctionResult AuctionManager::Impur(DWORD purchaser_id, const char* purchaser_na CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } @@ -533,14 +533,14 @@ AuctionResult AuctionManager::GetAuctionedItem (DWORD actor_id, DWORD item_id, T CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } @@ -561,14 +561,14 @@ AuctionResult AuctionManager::BuySoldItem (DWORD actor_id, DWORD item_id, TPlaye CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } @@ -584,14 +584,14 @@ AuctionResult AuctionManager::CancelAuction (DWORD actor_id, DWORD item_id, TPla CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CAuctionItemInfoCache* item_info_cache = Auction.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } TAuctionItemInfo* item_info = item_info_cache->Get(false); @@ -618,14 +618,14 @@ AuctionResult AuctionManager::CancelSale (DWORD actor_id, DWORD item_id, TPlayer CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } CSaleItemInfoCache* item_info_cache = Sale.GetItemInfoCache(item_id); if (item_info_cache == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } TSaleItemInfo* item_info = item_info_cache->Get(false); @@ -639,13 +639,13 @@ AuctionResult AuctionManager::DeleteAuctionItem (DWORD actor_id, DWORD item_id) { if (DeleteItemCache (item_id) == false) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } if (Auction.DeleteItemInfoCache (item_id) == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } return AUCTION_SUCCESS; @@ -655,13 +655,13 @@ AuctionResult AuctionManager::DeleteSaleItem (DWORD actor_id, DWORD item_id) { if (DeleteItemCache (item_id) == false) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } if (Sale.DeleteItemInfoCache (item_id) == NULL) { - sys_err ("how can this accident happen?"); + SPDLOG_ERROR("how can this accident happen?"); return AUCTION_FAIL; } return AUCTION_SUCCESS; @@ -672,7 +672,7 @@ AuctionResult AuctionManager::ReBid(DWORD bidder_id, const char* bidder_name, DW CItemCache* c = GetItemCache (item_id); if (c == NULL) { - sys_err ("item id : %d does not exist in auction.", item_id); + SPDLOG_ERROR("item id : {} does not exist in auction.", item_id); return AUCTION_FAIL; } diff --git a/src/db/src/BlockCountry.cpp b/src/db/src/BlockCountry.cpp index c28fdb6..bb69e80 100644 --- a/src/db/src/BlockCountry.cpp +++ b/src/db/src/BlockCountry.cpp @@ -50,7 +50,7 @@ bool CBlockCountry::Load() if (pMsg->Get()->uiNumRows == 0) { - sys_err(" DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR(" DirectQuery failed({})", szQuery); delete pMsg; return false; } @@ -64,7 +64,7 @@ bool CBlockCountry::Load() strlcpy(block_ip->country, row[2], sizeof(block_ip->country)); m_block_ip.push_back(block_ip); - sys_log(0, "BLOCKED_IP : %u - %u", block_ip->ip_from, block_ip->ip_to); + SPDLOG_DEBUG("BLOCKED_IP : {} - {}", block_ip->ip_from, block_ip->ip_to); } delete pMsg; @@ -79,7 +79,7 @@ bool CBlockCountry::Load() if (pMsg->Get()->uiNumRows == 0) { - sys_err(" DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR(" DirectQuery failed({})", szQuery); delete pMsg; return true; } @@ -91,7 +91,7 @@ bool CBlockCountry::Load() m_block_exception.push_back(strdup(login)); - sys_log(0, "BLOCK_EXCEPTION = %s", login); + SPDLOG_DEBUG("BLOCK_EXCEPTION = {}", login); } delete pMsg; @@ -129,7 +129,7 @@ bool CBlockCountry::IsBlockedCountryIp(const char *user_ip) void CBlockCountry::SendBlockedCountryIp(CPeer *peer) { - sys_log(0, "SendBlockedCountryIp start"); + SPDLOG_DEBUG("SendBlockedCountryIp start"); BLOCK_IP *block_ip; BLOCK_IP_VECTOR::iterator iter; TPacketBlockCountryIp packet; @@ -145,9 +145,9 @@ void CBlockCountry::SendBlockedCountryIp(CPeer *peer) peer->Encode(&packet, sizeof(packet)); } - sys_log(0, "[DONE] CBlockCountry::SendBlockedCountryIp() : count = %d", + SPDLOG_DEBUG("[DONE] CBlockCountry::SendBlockedCountryIp() : count = {}", m_block_ip.size()); - sys_log(0, "SendBlockedCountryIp end"); + SPDLOG_DEBUG("SendBlockedCountryIp end"); } /* end of CBlockCountry::SendBlockedCountryIp() */ diff --git a/src/db/src/Cache.cpp b/src/db/src/Cache.cpp index 5c6cd54..106afae 100644 --- a/src/db/src/Cache.cpp +++ b/src/db/src/Cache.cpp @@ -44,8 +44,7 @@ void CItemCache::Delete() //char szQuery[QUERY_MAX_LEN]; //szQuery[QUERY_MAX_LEN] = '\0'; - if (g_test_server) - sys_log(0, "ItemCache::Delete : DELETE %u", m_data.id); + SPDLOG_TRACE("ItemCache::Delete : DELETE {}", m_data.id); m_data.vnum = 0; m_bNeedQuery = true; @@ -64,8 +63,7 @@ void CItemCache::OnFlush() snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), m_data.id); CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_DESTROY, 0, NULL); - if (g_test_server) - sys_log(0, "ItemCache::Flush : DELETE %u %s", m_data.id, szQuery); + SPDLOG_TRACE("ItemCache::Flush : DELETE {} {}", m_data.id, szQuery); } else { @@ -141,8 +139,7 @@ void CItemCache::OnFlush() char szItemQuery[QUERY_MAX_LEN + QUERY_MAX_LEN + 100]; snprintf(szItemQuery, sizeof(szItemQuery), "REPLACE INTO item%s (%s) VALUES(%s)", GetTablePostfix(), szColumns, szValues); - if (g_test_server) - sys_log(0, "ItemCache::Flush :REPLACE (%s)", szItemQuery); + SPDLOG_TRACE("ItemCache::Flush :REPLACE ({})", szItemQuery); CDBManager::instance().ReturnQuery(szItemQuery, QID_ITEM_SAVE, 0, NULL); @@ -167,8 +164,7 @@ CPlayerTableCache::~CPlayerTableCache() void CPlayerTableCache::OnFlush() { - if (g_test_server) - sys_log(0, "PlayerTableCache::Flush : %s", m_data.name); + SPDLOG_TRACE("PlayerTableCache::Flush : {}", m_data.name); char szQuery[QUERY_MAX_LEN]; CreatePlayerSaveQuery(szQuery, sizeof(szQuery), &m_data); @@ -211,7 +207,7 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList if (pUpdateList->byCount > SHOP_PRICELIST_MAX_NUM) { - sys_err("Count overflow!"); + SPDLOG_ERROR("Count overflow!"); return; } @@ -238,8 +234,8 @@ void CItemPriceListTableCache::UpdateList(const TItemPriceListTable* pUpdateList m_bNeedQuery = true; - sys_log(0, - "ItemPriceListTableCache::UpdateList : OwnerID[%u] Update [%u] Items, Delete [%u] Items, Total [%u] Items", + SPDLOG_DEBUG( + "ItemPriceListTableCache::UpdateList : OwnerID[{}] Update [{}] Items, Delete [{}] Items, Total [{}] Items", m_data.dwOwnerID, pUpdateList->byCount, nDeletedNum, m_data.byCount); } @@ -266,7 +262,7 @@ void CItemPriceListTableCache::OnFlush() CDBManager::instance().ReturnQuery(szQuery, QID_ITEMPRICE_SAVE, 0, NULL); } - sys_log(0, "ItemPriceListTableCache::Flush : OwnerID[%u] Update [%u]Items", m_data.dwOwnerID, m_data.byCount); + SPDLOG_DEBUG("ItemPriceListTableCache::Flush : OwnerID[{}] Update [{}]Items", m_data.dwOwnerID, m_data.byCount); m_bNeedQuery = false; } @@ -287,8 +283,7 @@ void CAuctionItemInfoCache::Delete() if (m_data.item_num == 0) return; - if (g_test_server) - sys_log(0, "CAuctionItemInfoCache::Delete : DELETE %u", m_data.item_id); + SPDLOG_TRACE("CAuctionItemInfoCache::Delete : DELETE {}", m_data.item_id); m_data.item_num = 0; m_bNeedQuery = true; diff --git a/src/db/src/ClientManager.cpp b/src/db/src/ClientManager.cpp index b0a8ce7..45d4c51 100644 --- a/src/db/src/ClientManager.cpp +++ b/src/db/src/ClientManager.cpp @@ -26,7 +26,6 @@ extern int g_iPlayerCacheFlushSeconds; extern int g_iItemCacheFlushSeconds; extern int g_test_server; -extern int g_log; extern std::string g_stLocale; extern std::string g_stLocaleNameColumn; bool CreateItemTableFromRes(MYSQL_RES * res, std::vector * pVec, DWORD dwPID); @@ -67,18 +66,16 @@ static void AcceptConnection( static void AcceptError(evconnlistener *listener, void *ctx) { struct event_base *base = evconnlistener_get_base(listener); int err = EVUTIL_SOCKET_ERROR(); - fprintf(stderr, "Got an error %d (%s) on the listener. " - "Shutting down.\n", err, evutil_socket_error_to_string(err)); + SPDLOG_CRITICAL("Got an error {} ({}) on the listener. Shutting down.", err, evutil_socket_error_to_string(err)); - event_base_loopexit(base, NULL); + event_base_loopexit(base, nullptr); } static void DescReadHandler(bufferevent *bev, void *ctx) { auto* peer = (CPeer*) ctx; if (peer == CClientManager::Instance().GetAuthPeer()) - if (g_log) - sys_log(0, "AUTH_PEER_READ: size %d", peer->GetRecvLength()); + SPDLOG_TRACE("AUTH_PEER_READ: size {}", peer->GetRecvLength()); CClientManager::Instance().ProcessPackets(peer); } @@ -87,18 +84,17 @@ static void DescWriteHandler(bufferevent *bev, void *ctx) { auto* peer = (CPeer*) ctx; if (peer == CClientManager::Instance().GetAuthPeer()) - if (g_log) - sys_log(0, "AUTH_PEER_WRITE: size %d", peer->GetSendLength()); + SPDLOG_TRACE("AUTH_PEER_WRITE: size {}", peer->GetSendLength()); } static void DescEventHandler(bufferevent *bev, short events, void *ctx) { auto* peer = (CPeer*) ctx; if (events & BEV_EVENT_ERROR) - sys_err("PEER libevent error, handle: %d", peer->GetHandle()); + SPDLOG_ERROR("PEER libevent error, handle: {}", peer->GetHandle()); if (events & BEV_EVENT_EOF) - sys_log(0, "PEER disconnected: handle %d", peer->GetHandle()); + SPDLOG_DEBUG("PEER disconnected: handle {}", peer->GetHandle()); // Either the socket was closed or an error occured, therefore we can disconnect this peer. if (events & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) @@ -164,7 +160,7 @@ bool CClientManager::Initialize() //BOOT_LOCALIZATION if (!InitializeLocalization()) { - fprintf(stderr, "Failed Localization Infomation so exit\n"); + SPDLOG_ERROR("Failed Localization Infomation so exit"); return false; } @@ -173,14 +169,14 @@ bool CClientManager::Initialize() if (!InitializeNowItemID()) { - fprintf(stderr, " Item range Initialize Failed. Exit DBCache Server\n"); + SPDLOG_ERROR(" Item range Initialize Failed. Exit DBCache Server"); return false; } //END_ITEM_UNIQUE_ID if (!InitializeTables()) { - sys_err("Table Initialize FAILED"); + SPDLOG_ERROR("Table Initialize FAILED"); return false; } @@ -197,7 +193,7 @@ bool CClientManager::Initialize() // Create a new libevent base and listen for new connections m_base = event_base_new(); if (!m_base) { - sys_err("Libevent base initialization FAILED!"); + SPDLOG_ERROR("Libevent base initialization FAILED!"); return false; } @@ -216,7 +212,7 @@ bool CClientManager::Initialize() (const sockaddr*)&sin, sizeof(sin) ); if (!m_listener) { - sys_err("Libevent listener initialization FAILED!"); + SPDLOG_ERROR("Libevent listener initialization FAILED!"); return false; } evconnlistener_set_error_cb(m_listener, AcceptError); @@ -228,7 +224,7 @@ bool CClientManager::Initialize() if (!CConfig::instance().GetValue("PLAYER_DELETE_LEVEL_LIMIT", &m_iPlayerDeleteLevelLimit)) { - sys_err("conf.txt: Cannot find PLAYER_DELETE_LEVEL_LIMIT, use default level %d", PLAYER_MAX_LEVEL_CONST + 1); + SPDLOG_ERROR("conf.txt: Cannot find PLAYER_DELETE_LEVEL_LIMIT, use default level {}", PLAYER_MAX_LEVEL_CONST + 1); m_iPlayerDeleteLevelLimit = PLAYER_MAX_LEVEL_CONST + 1; } @@ -237,8 +233,8 @@ bool CClientManager::Initialize() m_iPlayerDeleteLevelLimitLower = 0; } - sys_log(0, "PLAYER_DELETE_LEVEL_LIMIT set to %d", m_iPlayerDeleteLevelLimit); - sys_log(0, "PLAYER_DELETE_LEVEL_LIMIT_LOWER set to %d", m_iPlayerDeleteLevelLimitLower); + SPDLOG_DEBUG("PLAYER_DELETE_LEVEL_LIMIT set to {}", m_iPlayerDeleteLevelLimit); + SPDLOG_DEBUG("PLAYER_DELETE_LEVEL_LIMIT_LOWER set to {}", m_iPlayerDeleteLevelLimitLower); m_bChinaEventServer = false; @@ -247,7 +243,7 @@ bool CClientManager::Initialize() if (CConfig::instance().GetValue("CHINA_EVENT_SERVER", &iChinaEventServer)) m_bChinaEventServer = (iChinaEventServer); - sys_log(0, "CHINA_EVENT_SERVER %s", CClientManager::instance().IsChinaEventServer()?"true":"false"); + SPDLOG_DEBUG("CHINA_EVENT_SERVER {}", CClientManager::instance().IsChinaEventServer()?"true":"false"); LoadEventFlag(); @@ -263,7 +259,7 @@ void CClientManager::MainLoop() { SQLMsg * tmp; - sys_log(0, "ClientManager pointer is %p", this); + SPDLOG_DEBUG("ClientManager pointer is {}", (void*) this); // ¸ÞÀηçÇÁ while (!m_bShutdowned) @@ -276,14 +272,12 @@ void CClientManager::MainLoop() if (!Process()) break; - - log_rotate(); - } + } // // ¸ÞÀηçÇÁ Á¾·áó¸® // - sys_log(0, "MainLoop exited, Starting cache flushing"); + SPDLOG_DEBUG("MainLoop exited, Starting cache flushing"); signal_timer_disable(); @@ -341,7 +335,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) __GetHostInfo(vHost); __GetAdminInfo(p->szIP, vAdmin); - sys_log(0, "QUERY_BOOT : AdminInfo (Request ServerIp %s) ", p->szIP); + SPDLOG_DEBUG("QUERY_BOOT : AdminInfo (Request ServerIp {}) ", p->szIP); DWORD dwPacketSize = sizeof(DWORD) + @@ -378,24 +372,24 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) peer->Encode(&dwPacketSize, sizeof(DWORD)); peer->Encode(&bPacketVersion, sizeof(BYTE)); - sys_log(0, "BOOT: PACKET: %d", dwPacketSize); - sys_log(0, "BOOT: VERSION: %d", bPacketVersion); + SPDLOG_DEBUG("BOOT: PACKET: {}", dwPacketSize); + SPDLOG_DEBUG("BOOT: VERSION: {}", bPacketVersion); - sys_log(0, "sizeof(TMobTable) = %d", sizeof(TMobTable)); - sys_log(0, "sizeof(TItemTable) = %d", sizeof(TItemTable)); - sys_log(0, "sizeof(TShopTable) = %d", sizeof(TShopTable)); - sys_log(0, "sizeof(TSkillTable) = %d", sizeof(TSkillTable)); - sys_log(0, "sizeof(TRefineTable) = %d", sizeof(TRefineTable)); - sys_log(0, "sizeof(TItemAttrTable) = %d", sizeof(TItemAttrTable)); - sys_log(0, "sizeof(TItemRareTable) = %d", sizeof(TItemAttrTable)); - sys_log(0, "sizeof(TBanwordTable) = %d", sizeof(TBanwordTable)); - sys_log(0, "sizeof(TLand) = %d", sizeof(building::TLand)); - sys_log(0, "sizeof(TObjectProto) = %d", sizeof(building::TObjectProto)); - sys_log(0, "sizeof(TObject) = %d", sizeof(building::TObject)); + SPDLOG_DEBUG("sizeof(TMobTable) = {}", sizeof(TMobTable)); + SPDLOG_DEBUG("sizeof(TItemTable) = {}", sizeof(TItemTable)); + SPDLOG_DEBUG("sizeof(TShopTable) = {}", sizeof(TShopTable)); + SPDLOG_DEBUG("sizeof(TSkillTable) = {}", sizeof(TSkillTable)); + SPDLOG_DEBUG("sizeof(TRefineTable) = {}", sizeof(TRefineTable)); + SPDLOG_DEBUG("sizeof(TItemAttrTable) = {}", sizeof(TItemAttrTable)); + SPDLOG_DEBUG("sizeof(TItemRareTable) = {}", sizeof(TItemAttrTable)); + SPDLOG_DEBUG("sizeof(TBanwordTable) = {}", sizeof(TBanwordTable)); + SPDLOG_DEBUG("sizeof(TLand) = {}", sizeof(building::TLand)); + SPDLOG_DEBUG("sizeof(TObjectProto) = {}", sizeof(building::TObjectProto)); + SPDLOG_DEBUG("sizeof(TObject) = {}", sizeof(building::TObject)); //ADMIN_MANAGER - sys_log(0, "sizeof(tAdminInfo) = %d * %d ", sizeof(tAdminInfo) * vAdmin.size()); + SPDLOG_DEBUG("sizeof(tAdminInfo) = {} * {} ", sizeof(tAdminInfo) * vAdmin.size()); //END_ADMIN_MANAGER - sys_log(0, "sizeof(TMonarchInfo) = %d * %d", sizeof(TMonarchInfo)); + SPDLOG_DEBUG("sizeof(TMonarchInfo) = {} * {}", sizeof(TMonarchInfo)); peer->EncodeWORD(sizeof(TMobTable)); peer->EncodeWORD(m_vec_mobTable.size()); @@ -470,7 +464,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) for (size_t n = 0; n < vHost.size(); ++n) { peer->Encode(vHost[n].c_str(), 16); - sys_log(0, "GMHosts %s", vHost[n].c_str()); + SPDLOG_DEBUG("GMHosts {}", vHost[n].c_str()); } peer->EncodeWORD(sizeof(tAdminInfo)); @@ -479,7 +473,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) for (size_t n = 0; n < vAdmin.size(); ++n) { peer->Encode(&vAdmin[n], sizeof(tAdminInfo)); - sys_log(0, "Admin name %s ConntactIP %s", vAdmin[n].m_szName, vAdmin[n].m_szContactIP); + SPDLOG_DEBUG("Admin name {} ConntactIP {}", vAdmin[n].m_szName, vAdmin[n].m_szContactIP); } //END_ADMIN_MANAGER @@ -498,8 +492,7 @@ void CClientManager::QUERY_BOOT(CPeer* peer, TPacketGDBoot * p) } //END_MONARCE - if (g_test_server) - sys_log(0, "MONARCHCandidacy Size %d", CMonarch::instance().MonarchCandidacySize()); + SPDLOG_TRACE("MONARCHCandidacy Size {}", CMonarch::instance().MonarchCandidacySize()); peer->EncodeWORD(0xffff); } @@ -510,13 +503,13 @@ void CClientManager::SendPartyOnSetup(CPeer* pkPeer) for (itertype(pm) it_party = pm.begin(); it_party != pm.end(); ++it_party) { - sys_log(0, "PARTY SendPartyOnSetup Party [%u]", it_party->first); + SPDLOG_DEBUG("PARTY SendPartyOnSetup Party [{}]", it_party->first); pkPeer->EncodeHeader(HEADER_DG_PARTY_CREATE, 0, sizeof(TPacketPartyCreate)); pkPeer->Encode(&it_party->first, sizeof(DWORD)); for (itertype(it_party->second) it_member = it_party->second.begin(); it_member != it_party->second.end(); ++it_member) { - sys_log(0, "PARTY SendPartyOnSetup Party [%u] Member [%u]", it_party->first, it_member->first); + SPDLOG_DEBUG("PARTY SendPartyOnSetup Party [{}] Member [{}]", it_party->first, it_member->first); pkPeer->EncodeHeader(HEADER_DG_PARTY_ADD, 0, sizeof(TPacketPartyAdd)); pkPeer->Encode(&it_party->first, sizeof(DWORD)); pkPeer->Encode(&it_member->first, sizeof(DWORD)); @@ -539,7 +532,7 @@ void CClientManager::QUERY_QUEST_SAVE(CPeer * pkPeer, TQuestTable * pTable, DWOR { if (0 != (dwLen % sizeof(TQuestTable))) { - sys_err("invalid packet size %d, sizeof(TQuestTable) == %d", dwLen, sizeof(TQuestTable)); + SPDLOG_ERROR("invalid packet size {}, sizeof(TQuestTable) == {}", dwLen, sizeof(TQuestTable)); return; } @@ -579,9 +572,8 @@ void CClientManager::QUERY_SAFEBOX_LOAD(CPeer * pkPeer, DWORD dwHandle, TSafebox snprintf(szQuery, sizeof(szQuery), "SELECT account_id, size, password FROM safebox%s WHERE account_id=%u", GetTablePostfix(), packet->dwID); - - if (g_log) - sys_log(0, "HEADER_GD_SAFEBOX_LOAD (handle: %d account.id %u is_mall %d)", dwHandle, packet->dwID, bMall ? 1 : 0); + + SPDLOG_TRACE("HEADER_GD_SAFEBOX_LOAD (handle: {} account.id {} is_mall {})", dwHandle, packet->dwID, bMall ? 1 : 0); CDBManager::instance().ReturnQuery(szQuery, QID_SAFEBOX_LOAD, pkPeer->GetHandle(), pi); } @@ -646,10 +638,10 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (pi->ip[0] == 1) { pSafebox->bSize = 1; - sys_log(0, "MALL id[%d] size[%d]", pSafebox->dwID, pSafebox->bSize); + SPDLOG_DEBUG("MALL id[{}] size[{}]", pSafebox->dwID, pSafebox->bSize); } else - sys_log(0, "SAFEBOX id[%d] size[%d]", pSafebox->dwID, pSafebox->bSize); + SPDLOG_DEBUG("SAFEBOX id[{}] size[{}]", pSafebox->dwID, pSafebox->bSize); } if (0 == pSafebox->dwID) @@ -679,7 +671,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (!pi->pSafebox) { - sys_err("null safebox pointer!"); + SPDLOG_ERROR("null safebox pointer!"); delete pi; return; } @@ -689,7 +681,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) // º¸À̱⠶§¹®¿¡ â°í°¡ ¾Æ¾ê ¾È¿­¸®´Â°Ô ³ªÀ½ if (!msg->Get()->pSQLResult) { - sys_err("null safebox result"); + SPDLOG_ERROR("null safebox result"); delete pi; return; } @@ -714,7 +706,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (it == m_map_itemTableByVnum.end()) { bEscape = true; - sys_err("invalid item vnum %u in safebox: login %s", r.vnum, pi->login); + SPDLOG_ERROR("invalid item vnum {} in safebox: login {}", r.vnum, pi->login); break; } @@ -747,7 +739,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (it == m_map_itemTableByVnum.end()) { - sys_err("invalid item vnum %u in item_award: login %s", pItemAward->dwVnum, pi->login); + SPDLOG_ERROR("invalid item vnum {} in item_award: login {}", pItemAward->dwVnum, pi->login); continue; } @@ -813,7 +805,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) if (GetItemID () > m_itemRange.dwMax) { - sys_err("UNIQUE ID OVERFLOW!!"); + SPDLOG_ERROR("UNIQUE ID OVERFLOW!!"); break; } @@ -821,13 +813,13 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) itertype(m_map_itemTableByVnum) it = m_map_itemTableByVnum.find (dwItemVnum); if (it == m_map_itemTableByVnum.end()) { - sys_err ("Invalid item(vnum : %d). It is not in m_map_itemTableByVnum.", dwItemVnum); + SPDLOG_ERROR("Invalid item(vnum : {}). It is not in m_map_itemTableByVnum.", dwItemVnum); continue; } TItemTable* item_table = it->second; if (item_table == NULL) { - sys_err ("Invalid item_table (vnum : %d). It's value is NULL in m_map_itemTableByVnum.", dwItemVnum); + SPDLOG_ERROR("Invalid item_table (vnum : {}). It's value is NULL in m_map_itemTableByVnum.", dwItemVnum); continue; } if (0 == pItemAward->dwSocket0) @@ -868,7 +860,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg) std::unique_ptr pmsg(CDBManager::instance().DirectQuery(szQuery)); SQLResult * pRes = pmsg->Get(); - sys_log(0, "SAFEBOX Query : [%s]", szQuery); + SPDLOG_DEBUG("SAFEBOX Query : [{}]", szQuery); if (pRes->uiAffectedRows == 0 || pRes->uiInsertID == 0 || pRes->uiAffectedRows == (uint32_t)-1) break; @@ -1029,7 +1021,7 @@ void CClientManager::RESULT_PRICELIST_LOAD(CPeer* peer, SQLMsg* pMsg) peer->Encode(&header, sizeof(header)); peer->Encode(table.aPriceInfo, sizePriceListSize); - sys_log(0, "Load MyShopPricelist handle[%d] pid[%d] count[%d]", pReqInfo->first, pReqInfo->second, header.byCount); + SPDLOG_DEBUG("Load MyShopPricelist handle[{}] pid[{}] count[{}]", pReqInfo->first, pReqInfo->second, header.byCount); delete pReqInfo; } @@ -1082,7 +1074,7 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE id=%u", GetTablePostfix(), p->bEmpire, p->dwAccountID); delete CDBManager::instance().DirectQuery(szQuery); - sys_log(0, "EmpireSelect: %s", szQuery); + SPDLOG_DEBUG("EmpireSelect: {}", szQuery); { snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4 FROM player_index%s WHERE id=%u", GetTablePostfix(), p->dwAccountID); @@ -1093,7 +1085,7 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire if (pRes->uiNumRows) { - sys_log(0, "EMPIRE %lu", pRes->uiNumRows); + SPDLOG_DEBUG("EMPIRE {}", pRes->uiNumRows); MYSQL_ROW row = mysql_fetch_row(pRes->pSQLResult); DWORD pids[3]; @@ -1118,11 +1110,11 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire for (int i = 0; i < 3; ++i) { str_to_number(pids[i], row[i]); - sys_log(0, "EMPIRE PIDS[%d]", pids[i]); + SPDLOG_DEBUG("EMPIRE PIDS[{}]", pids[i]); if (pids[i]) { - sys_log(0, "EMPIRE move to pid[%d] to villiage of %u, map_index %d", + SPDLOG_DEBUG("EMPIRE move to pid[{}] to villiage of {}, map_index {}", pids[i], p->bEmpire, g_start_map[p->bEmpire]); snprintf(szQuery, sizeof(szQuery), "UPDATE player%s SET map_index=%u,x=%u,y=%u WHERE id=%u", @@ -1149,7 +1141,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD if (p->bAuthServer) { - sys_log(0, "AUTH_PEER ptr %p", peer); + SPDLOG_DEBUG("AUTH_PEER ptr {}", (void*) peer); m_pkAuthPeer = peer; SendAllLoginToBilling(); @@ -1272,7 +1264,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD // // ¼Â¾÷ : Á¢¼ÓÇÑ ÇǾ ´Ù¸¥ ÇǾîµéÀÌ Á¢¼ÓÇÏ°Ô ¸¸µç´Ù. (P2P ÄÁ³Ø¼Ç »ý¼º) // - sys_log(0, "SETUP: channel %u listen %u p2p %u count %u", peer->GetChannel(), p->wListenPort, p->wP2PPort, bMapCount); + SPDLOG_DEBUG("SETUP: channel {} listen {} p2p {} count {}", peer->GetChannel(), p->wListenPort, p->wP2PPort, bMapCount); TPacketDGP2P p2pSetupPacket; p2pSetupPacket.wPort = peer->GetP2PPort(); @@ -1319,7 +1311,7 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD if (InsertLogonAccount(pck->szLogin, peer->GetHandle(), pck->szHost)) { - sys_log(0, "SETUP: login %u %s login_key %u host %s", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost); + SPDLOG_DEBUG("SETUP: login {} {} login_key {} host {}", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost); pkLD->SetPlay(true); if (m_pkAuthPeer) @@ -1332,12 +1324,12 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD } } else - sys_log(0, "SETUP: login_fail %u %s login_key %u", pck->dwID, pck->szLogin, pck->dwLoginKey); + SPDLOG_DEBUG("SETUP: login_fail {} {} login_key {}", pck->dwID, pck->szLogin, pck->dwLoginKey); } if (m_pkAuthPeer && !vec_repair.empty()) { - sys_log(0, "REPAIR size %d", vec_repair.size()); + SPDLOG_DEBUG("REPAIR size {}", vec_repair.size()); m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_REPAIR, 0, sizeof(DWORD) + sizeof(TPacketBillingRepair) * vec_repair.size()); m_pkAuthPeer->EncodeDWORD(vec_repair.size()); @@ -1355,8 +1347,7 @@ void CClientManager::QUERY_ITEM_FLUSH(CPeer * pkPeer, const char * c_pData) { DWORD dwID = *(DWORD *) c_pData; - if (g_log) - sys_log(0, "HEADER_GD_ITEM_FLUSH: %u", dwID); + SPDLOG_TRACE("HEADER_GD_ITEM_FLUSH: {}", dwID); CItemCache * c = GetItemCache(dwID); @@ -1381,8 +1372,7 @@ void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData) if (it != m_map_pkItemCacheSetPtr.end()) { - if (g_test_server) - sys_log(0, "ITEM_CACHE: safebox owner %u id %u", c->Get()->owner, c->Get()->id); + SPDLOG_TRACE("ITEM_CACHE: safebox owner {} id {}", c->Get()->owner, c->Get()->id); it->second->erase(c); } @@ -1426,14 +1416,13 @@ void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData) #ifdef __AUCTION__ else if (p->window == AUCTION) { - sys_err("invalid window. how can you enter this route?"); + SPDLOG_ERROR("invalid window. how can you enter this route?"); return ; } #endif else { - if (g_test_server) - sys_log(0, "QUERY_ITEM_SAVE => PutItemCache() owner %d id %d vnum %d ", p->owner, p->id, p->vnum); + SPDLOG_TRACE("QUERY_ITEM_SAVE => PutItemCache() owner {} id {} vnum {} ", p->owner, p->id, p->vnum); PutItemCache(p); } @@ -1457,8 +1446,7 @@ void CClientManager::CreateItemCacheSet(DWORD pid) TItemCacheSet * pSet = new TItemCacheSet; m_map_pkItemCacheSetPtr.insert(TItemCacheSetPtrMap::value_type(pid, pSet)); - if (g_log) - sys_log(0, "ITEM_CACHE: new cache %u", pid); + SPDLOG_TRACE("ITEM_CACHE: new cache {}", pid); } void CClientManager::FlushItemCacheSet(DWORD pid) @@ -1467,7 +1455,7 @@ void CClientManager::FlushItemCacheSet(DWORD pid) if (it == m_map_pkItemCacheSetPtr.end()) { - sys_log(0, "FLUSH_ITEMCACHESET : No ItemCacheSet pid(%d)", pid); + SPDLOG_DEBUG("FLUSH_ITEMCACHESET : No ItemCacheSet pid({})", pid); return; } @@ -1488,8 +1476,7 @@ void CClientManager::FlushItemCacheSet(DWORD pid) m_map_pkItemCacheSetPtr.erase(it); - if (g_log) - sys_log(0, "FLUSH_ITEMCACHESET : Deleted pid(%d)", pid); + SPDLOG_TRACE("FLUSH_ITEMCACHESET : Deleted pid({})", pid); } CItemCache * CClientManager::GetItemCache(DWORD id) @@ -1511,8 +1498,7 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) // ¾ÆÀÌÅÛ »õ·Î »ý¼º if (!c) { - if (g_log) - sys_log(0, "ITEM_CACHE: PutItemCache ==> New CItemCache id%d vnum%d new owner%d", pNew->id, pNew->vnum, pNew->owner); + SPDLOG_TRACE("ITEM_CACHE: PutItemCache ==> New CItemCache id{} vnum{} new owner{}", pNew->id, pNew->vnum, pNew->owner); c = new CItemCache; m_map_itemCache.insert(TItemCacheMap::value_type(pNew->id, c)); @@ -1520,8 +1506,8 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) // ÀÖÀ»½Ã else { - if (g_log) - sys_log(0, "ITEM_CACHE: PutItemCache ==> Have Cache"); + SPDLOG_TRACE("ITEM_CACHE: PutItemCache ==> Have Cache"); + // ¼ÒÀ¯ÀÚ°¡ Ʋ¸®¸é if (pNew->owner != c->Get()->owner) { @@ -1530,8 +1516,7 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) if (it != m_map_pkItemCacheSetPtr.end()) { - if (g_log) - sys_log(0, "ITEM_CACHE: delete owner %u id %u new owner %u", c->Get()->owner, c->Get()->id, pNew->owner); + SPDLOG_TRACE("ITEM_CACHE: delete owner {} id {} new owner {}", c->Get()->owner, c->Get()->id, pNew->owner); it->second->erase(c); } } @@ -1544,20 +1529,14 @@ void CClientManager::PutItemCache(TPlayerItem * pNew, bool bSkipQuery) if (it != m_map_pkItemCacheSetPtr.end()) { - if (g_log) - sys_log(0, "ITEM_CACHE: save %u id %u", c->Get()->owner, c->Get()->id); - else - sys_log(1, "ITEM_CACHE: save %u id %u", c->Get()->owner, c->Get()->id); + SPDLOG_TRACE("ITEM_CACHE: save {} id {}", c->Get()->owner, c->Get()->id); it->second->insert(c); } else { // ÇöÀç ¼ÒÀ¯ÀÚ°¡ ¾øÀ¸¹Ç·Î ¹Ù·Î ÀúÀåÇØ¾ß ´ÙÀ½ Á¢¼ÓÀÌ ¿Ã ¶§ SQL¿¡ Äõ¸®ÇÏ¿© // ¹ÞÀ» ¼ö ÀÖÀ¸¹Ç·Î ¹Ù·Î ÀúÀåÇÑ´Ù. - if (g_log) - sys_log(0, "ITEM_CACHE: direct save %u id %u", c->Get()->owner, c->Get()->id); - else - sys_log(1, "ITEM_CACHE: direct save %u id %u", c->Get()->owner, c->Get()->id); + SPDLOG_TRACE("ITEM_CACHE: direct save {} id {}", c->Get()->owner, c->Get()->id); c->OnFlush(); } @@ -1608,8 +1587,7 @@ void CClientManager::UpdatePlayerCache() if (c->CheckTimeout()) { - if (g_log) - sys_log(0, "UPDATE : UpdatePlayerCache() ==> FlushPlayerCache %d %s ", c->Get(false)->id, c->Get(false)->name); + SPDLOG_TRACE("UPDATE : UpdatePlayerCache() ==> FlushPlayerCache {} {} ", c->Get(false)->id, c->Get(false)->name); c->Flush(); @@ -1625,7 +1603,7 @@ void CClientManager::UpdatePlayerCache() void CClientManager::SetCacheFlushCountLimit(int iLimit) { m_iCacheFlushCountLimit = std::max(10, iLimit); - sys_log(0, "CACHE_FLUSH_LIMIT_PER_SECOND: %d", m_iCacheFlushCountLimit); + SPDLOG_DEBUG("CACHE_FLUSH_LIMIT_PER_SECOND: {}", m_iCacheFlushCountLimit); } void CClientManager::UpdateItemCache() @@ -1642,8 +1620,7 @@ void CClientManager::UpdateItemCache() // ¾ÆÀÌÅÛÀº Flush¸¸ ÇÑ´Ù. if (c->CheckFlushTimeout()) { - if (g_test_server) - sys_log(0, "UpdateItemCache ==> Flush() vnum %d id owner %d", c->Get()->vnum, c->Get()->id, c->Get()->owner); + SPDLOG_TRACE("UpdateItemCache ==> Flush() vnum {} id owner {}", c->Get()->vnum, c->Get()->id, c->Get()->owner); c->Flush(); @@ -1683,8 +1660,7 @@ void CClientManager::QUERY_ITEM_DESTROY(CPeer * pkPeer, const char * c_pData) char szQuery[64]; snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), dwID); - if (g_log) - sys_log(0, "HEADER_GD_ITEM_DESTROY: PID %u ID %u", dwPID, dwID); + SPDLOG_TRACE("HEADER_GD_ITEM_DESTROY: PID {} ID {}", dwPID, dwID); if (dwPID == 0) // ¾Æ¹«µµ °¡Áø »ç¶÷ÀÌ ¾ø¾ú´Ù¸é, ºñµ¿±â Äõ¸® CDBManager::instance().AsyncQuery(szQuery); @@ -1702,7 +1678,7 @@ void CClientManager::QUERY_FLUSH_CACHE(CPeer * pkPeer, const char * c_pData) if (!pkCache) return; - sys_log(0, "FLUSH_CACHE: %u", dwPID); + SPDLOG_DEBUG("FLUSH_CACHE: {}", dwPID); pkCache->Flush(); FlushItemCacheSet(dwPID); @@ -1731,7 +1707,7 @@ void CClientManager::QUERY_RELOAD_PROTO() { if (!InitializeTables()) { - sys_err("QUERY_RELOAD_PROTO: cannot load tables"); + SPDLOG_ERROR("QUERY_RELOAD_PROTO: cannot load tables"); return; } @@ -1844,8 +1820,7 @@ void CClientManager::DeleteLoginData(CLoginData * pkLD) void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDAuthLogin * p) { - if (g_test_server) - sys_log(0, "QUERY_AUTH_LOGIN %d %d %s", p->dwID, p->dwLoginKey, p->szLogin); + SPDLOG_TRACE("QUERY_AUTH_LOGIN {} {} {}", p->dwID, p->dwLoginKey, p->szLogin); CLoginData * pkLD = GetLoginDataByLogin(p->szLogin); if (pkLD) @@ -1857,7 +1832,7 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA if (GetLoginData(p->dwLoginKey)) { - sys_err("LoginData already exist key %u login %s", p->dwLoginKey, p->szLogin); + SPDLOG_ERROR("LoginData already exist key {} login {}", p->dwLoginKey, p->szLogin); bResult = 0; pkPeer->EncodeHeader(HEADER_DG_AUTH_LOGIN, dwHandle, sizeof(BYTE)); @@ -1880,7 +1855,7 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA strlcpy(r.social_id, p->szSocialID, sizeof(r.social_id)); strlcpy(r.passwd, "TEMP", sizeof(r.passwd)); - sys_log(0, "AUTH_LOGIN id(%u) login(%s) social_id(%s) login_key(%u), client_key(%u %u %u %u)", + SPDLOG_DEBUG("AUTH_LOGIN id({}) login({}) social_id({}) login_key({}), client_key({} {} {} {})", p->dwID, p->szLogin, p->szSocialID, p->dwLoginKey, p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3]); @@ -1961,20 +1936,20 @@ void CClientManager::BillingCheck(const char * data) std::vector vec; - sys_log(0, "BillingCheck: size %u", dwCount); + SPDLOG_DEBUG("BillingCheck: size {}", dwCount); for (DWORD i = 0; i < dwCount; ++i) { DWORD dwKey = *(DWORD *) data; data += sizeof(DWORD); - sys_log(0, "BillingCheck: %u", dwKey); + SPDLOG_DEBUG("BillingCheck: {}", dwKey); TLoginDataByLoginKey::iterator it = m_map_pkLoginData.find(dwKey); if (it == m_map_pkLoginData.end()) { - sys_log(0, "BillingCheck: key not exist: %u", dwKey); + SPDLOG_DEBUG("BillingCheck: key not exist: {}", dwKey); vec.push_back(dwKey); } else @@ -1983,7 +1958,7 @@ void CClientManager::BillingCheck(const char * data) if (!pkLD->IsPlay() && curTime - pkLD->GetLastPlayTime() > 180) { - sys_log(0, "BillingCheck: not login: %u", dwKey); + SPDLOG_DEBUG("BillingCheck: not login: {}", dwKey); vec.push_back(dwKey); } } @@ -2033,7 +2008,7 @@ void CClientManager::SendAllLoginToBilling() p.dwLoginKey = pkLD->GetKey(); strlcpy(p.szLogin, pkLD->GetAccountRef().login, sizeof(p.szLogin)); strlcpy(p.szHost, pkLD->GetIP(), sizeof(p.szHost)); - sys_log(0, "SendAllLoginToBilling %s %s", pkLD->GetAccountRef().login, pkLD->GetIP()); + SPDLOG_DEBUG("SendAllLoginToBilling {} {}", pkLD->GetAccountRef().login, pkLD->GetIP()); vec.push_back(p); } @@ -2075,7 +2050,7 @@ void CClientManager::CreateObject(TPacketGDCreateObject * p) if (pmsg->Get()->uiInsertID == 0) { - sys_err("cannot insert object"); + SPDLOG_ERROR("cannot insert object"); return; } @@ -2109,7 +2084,7 @@ void CClientManager::DeleteObject(DWORD dwID) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_err("no object by id %u", dwID); + SPDLOG_ERROR("no object by id {}", dwID); return; } @@ -2152,7 +2127,7 @@ void CClientManager::UpdateLand(DWORD * pdw) void CClientManager::VCard(TPacketGDVCard * p) { - sys_log(0, "VCARD: %u %s %s %s %s", + SPDLOG_DEBUG("VCARD: {} {} {} {} {}", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount); m_queue_vcard.push(*p); @@ -2208,39 +2183,39 @@ void CClientManager::BlockChat(TPacketBlockChat* p) void CClientManager::MarriageAdd(TPacketMarriageAdd * p) { - sys_log(0, "MarriageAdd %u %u %s %s", p->dwPID1, p->dwPID2, p->szName1, p->szName2); + SPDLOG_DEBUG("MarriageAdd {} {} {} {}", p->dwPID1, p->dwPID2, p->szName1, p->szName2); marriage::CManager::instance().Add(p->dwPID1, p->dwPID2, p->szName1, p->szName2); } void CClientManager::MarriageUpdate(TPacketMarriageUpdate * p) { - sys_log(0, "MarriageUpdate PID:%u %u LP:%d ST:%d", p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); + SPDLOG_DEBUG("MarriageUpdate PID:{} {} LP:{} ST:{}", p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); marriage::CManager::instance().Update(p->dwPID1, p->dwPID2, p->iLovePoint, p->byMarried); } void CClientManager::MarriageRemove(TPacketMarriageRemove * p) { - sys_log(0, "MarriageRemove %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("MarriageRemove {} {}", p->dwPID1, p->dwPID2); marriage::CManager::instance().Remove(p->dwPID1, p->dwPID2); } void CClientManager::WeddingRequest(TPacketWeddingRequest * p) { - sys_log(0, "WeddingRequest %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingRequest {} {}", p->dwPID1, p->dwPID2); ForwardPacket(HEADER_DG_WEDDING_REQUEST, p, sizeof(TPacketWeddingRequest)); //marriage::CManager::instance().RegisterWedding(p->dwPID1, p->szName1, p->dwPID2, p->szName2); } void CClientManager::WeddingReady(TPacketWeddingReady * p) { - sys_log(0, "WeddingReady %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingReady {} {}", p->dwPID1, p->dwPID2); ForwardPacket(HEADER_DG_WEDDING_READY, p, sizeof(TPacketWeddingReady)); marriage::CManager::instance().ReadyWedding(p->dwMapIndex, p->dwPID1, p->dwPID2); } void CClientManager::WeddingEnd(TPacketWeddingEnd * p) { - sys_log(0, "WeddingEnd %u %u", p->dwPID1, p->dwPID2); + SPDLOG_DEBUG("WeddingEnd {} {}", p->dwPID1, p->dwPID2); marriage::CManager::instance().EndWedding(p->dwPID1, p->dwPID2); } @@ -2252,7 +2227,7 @@ void CClientManager::MyshopPricelistUpdate(const TPacketMyshopPricelistHeader* p { if (pPacket->byCount > SHOP_PRICELIST_MAX_NUM) { - sys_err("count overflow!"); + SPDLOG_ERROR("count overflow!"); return; } @@ -2293,7 +2268,7 @@ void CClientManager::MyshopPricelistRequest(CPeer* peer, DWORD dwHandle, DWORD d { if (CItemPriceListTableCache* pCache = GetItemPriceListCache(dwPlayerID)) { - sys_log(0, "Cache MyShopPricelist handle[%d] pid[%d]", dwHandle, dwPlayerID); + SPDLOG_DEBUG("Cache MyShopPricelist handle[{}] pid[{}]", dwHandle, dwPlayerID); TItemPriceListTable* pTable = pCache->Get(false); @@ -2312,7 +2287,7 @@ void CClientManager::MyshopPricelistRequest(CPeer* peer, DWORD dwHandle, DWORD d } else { - sys_log(0, "Query MyShopPricelist handle[%d] pid[%d]", dwHandle, dwPlayerID); + SPDLOG_DEBUG("Query MyShopPricelist handle[{}] pid[{}]", dwHandle, dwPlayerID); char szQuery[QUERY_MAX_LEN]; snprintf(szQuery, sizeof(szQuery), "SELECT item_vnum, price FROM myshop_pricelist%s WHERE owner_id=%u", GetTablePostfix(), dwPlayerID); @@ -2347,29 +2322,9 @@ void CClientManager::ProcessPackets(CPeer * peer) while (peer->PeekPacket(i, header, dwHandle, dwLength, &data)) { - // DISABLE_DB_HEADER_LOG - // sys_log(0, "header %d %p size %d", header, this, dwLength); - // END_OF_DISABLE_DB_HEADER_LOG m_bLastHeader = header; ++iCount; -#ifdef _TEST - if (header != 10) - sys_log(0, " ProcessPacket Header [%d] Handle[%d] Length[%d] iCount[%d]", header, dwHandle, dwLength, iCount); -#endif - if (g_test_server) - { - if (header != 10) - sys_log(0, " ProcessPacket Header [%d] Handle[%d] Length[%d] iCount[%d]", header, dwHandle, dwLength, iCount); - } - - - // test log by mhh - { - if (HEADER_GD_BLOCK_COUNTRY_IP == header) - sys_log(0, "recved : HEADER_GD_BLOCK_COUNTRY_IP"); - } - switch (header) { case HEADER_GD_BOOT: @@ -2384,28 +2339,28 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_LOGOUT: - //sys_log(0, "HEADER_GD_LOGOUT (handle: %d length: %d)", dwHandle, dwLength); + //SPDLOG_DEBUG("HEADER_GD_LOGOUT (handle: {} length: {})", dwHandle, dwLength); QUERY_LOGOUT(peer, dwHandle, data); break; case HEADER_GD_PLAYER_LOAD: - sys_log(1, "HEADER_GD_PLAYER_LOAD (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_PLAYER_LOAD (handle: {} length: {})", dwHandle, dwLength); QUERY_PLAYER_LOAD(peer, dwHandle, (TPlayerLoadPacket *) data); break; case HEADER_GD_PLAYER_SAVE: - sys_log(1, "HEADER_GD_PLAYER_SAVE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_PLAYER_SAVE (handle: {} length: {})", dwHandle, dwLength); QUERY_PLAYER_SAVE(peer, dwHandle, (TPlayerTable *) data); break; case HEADER_GD_PLAYER_CREATE: - sys_log(0, "HEADER_GD_PLAYER_CREATE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_DEBUG("HEADER_GD_PLAYER_CREATE (handle: {} length: {})", dwHandle, dwLength); __QUERY_PLAYER_CREATE(peer, dwHandle, (TPlayerCreatePacket *) data); - sys_log(0, "END"); + SPDLOG_DEBUG("END"); break; case HEADER_GD_PLAYER_DELETE: - sys_log(1, "HEADER_GD_PLAYER_DELETE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_PLAYER_DELETE (handle: {} length: {})", dwHandle, dwLength); __QUERY_PLAYER_DELETE(peer, dwHandle, (TPlayerDeletePacket *) data); break; @@ -2414,7 +2369,7 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_QUEST_SAVE: - sys_log(1, "HEADER_GD_QUEST_SAVE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_QUEST_SAVE (handle: {} length: {})", dwHandle, dwLength); QUERY_QUEST_SAVE(peer, (TQuestTable *) data, dwLength); break; @@ -2423,7 +2378,7 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_SAFEBOX_SAVE: - sys_log(1, "HEADER_GD_SAFEBOX_SAVE (handle: %d length: %d)", dwHandle, dwLength); + SPDLOG_TRACE("HEADER_GD_SAFEBOX_SAVE (handle: {} length: {})", dwHandle, dwLength); QUERY_SAFEBOX_SAVE(peer, (TSafeboxTable *) data); break; @@ -2512,12 +2467,12 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_ADD_AFFECT: - sys_log(1, "HEADER_GD_ADD_AFFECT"); + SPDLOG_TRACE("HEADER_GD_ADD_AFFECT"); QUERY_ADD_AFFECT(peer, (TPacketGDAddAffect *) data); break; case HEADER_GD_REMOVE_AFFECT: - sys_log(1, "HEADER_GD_REMOVE_AFFECT"); + SPDLOG_TRACE("HEADER_GD_REMOVE_AFFECT"); QUERY_REMOVE_AFFECT(peer, (TPacketGDRemoveAffect *) data); break; @@ -2718,13 +2673,13 @@ void CClientManager::ProcessPackets(CPeer * peer) break; case HEADER_GD_BLOCK_COUNTRY_IP: - sys_log(0, "HEADER_GD_BLOCK_COUNTRY_IP received"); + SPDLOG_DEBUG("HEADER_GD_BLOCK_COUNTRY_IP received"); CBlockCountry::instance().SendBlockedCountryIp(peer); CBlockCountry::instance().SendBlockException(peer); break; case HEADER_GD_BLOCK_EXCEPTION: - sys_log(0, "HEADER_GD_BLOCK_EXCEPTION received"); + SPDLOG_DEBUG("HEADER_GD_BLOCK_EXCEPTION received"); BlockException((TPacketBlockException*) data); break; @@ -2823,7 +2778,7 @@ void CClientManager::ProcessPackets(CPeer * peer) break; #endif default: - sys_err("Unknown header (header: %d handle: %d length: %d)", header, dwHandle, dwLength); + SPDLOG_ERROR("Unknown header (header: {} handle: {} length: {})", header, dwHandle, dwLength); break; } } @@ -2868,7 +2823,7 @@ void CClientManager::RemovePeer(CPeer * pPeer) if (pkLD->IsDeleted()) { - sys_log(0, "DELETING LoginData"); + SPDLOG_DEBUG("DELETING LoginData"); delete pkLD; } @@ -2919,7 +2874,7 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) #ifdef _TEST if (qi->iType != QID_ITEM_AWARD_LOAD) - sys_log(0, "AnalyzeQueryResult %d", qi->iType); + SPDLOG_DEBUG("AnalyzeQueryResult {}", qi->iType); #endif switch (qi->iType) { @@ -2941,7 +2896,7 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) if (!peer) { - //sys_err("CClientManager::AnalyzeQueryResult: peer not exist anymore. (ident: %d)", qi->dwIdent); + //SPDLOG_ERROR("CClientManager::AnalyzeQueryResult: peer not exist anymore. (ident: {})", qi->dwIdent); delete qi; return true; } @@ -2960,27 +2915,27 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) break; case QID_SAFEBOX_LOAD: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_LOAD"); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_LOAD"); RESULT_SAFEBOX_LOAD(peer, msg); break; case QID_SAFEBOX_CHANGE_SIZE: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_SIZE"); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_SIZE"); RESULT_SAFEBOX_CHANGE_SIZE(peer, msg); break; case QID_SAFEBOX_CHANGE_PASSWORD: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD %p", msg); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD {}", (void*) msg); RESULT_SAFEBOX_CHANGE_PASSWORD(peer, msg); break; case QID_SAFEBOX_CHANGE_PASSWORD_SECOND: - sys_log(0, "QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD %p", msg); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_SAFEBOX_CHANGE_PASSWORD {}", (void*) msg); RESULT_SAFEBOX_CHANGE_PASSWORD_SECOND(peer, msg); break; case QID_HIGHSCORE_REGISTER: - sys_log(0, "QUERY_RESULT: HEADER_GD_HIGHSCORE_REGISTER %p", msg); + SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_HIGHSCORE_REGISTER {}", (void*) msg); RESULT_HIGHSCORE_REGISTER(peer, msg); break; @@ -3013,7 +2968,7 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg) // END_OF_MYSHOP_PRICE_LIST default: - sys_log(0, "CClientManager::AnalyzeQueryResult unknown query result type: %d, str: %s", qi->iType, msg->stQuery.c_str()); + SPDLOG_DEBUG("CClientManager::AnalyzeQueryResult unknown query result type: {}, str: {}", qi->iType, msg->stQuery); break; } @@ -3067,7 +3022,7 @@ int CClientManager::Process() { g_iPlayerCacheFlushSeconds = std::max(60, rand() % 180); g_iItemCacheFlushSeconds = std::max(60, rand() % 180); - sys_log(0, "[SAVE_TIME]Change saving time item %d player %d", g_iPlayerCacheFlushSeconds, g_iItemCacheFlushSeconds); + SPDLOG_DEBUG("[SAVE_TIME]Change saving time item {} player {}", g_iPlayerCacheFlushSeconds, g_iItemCacheFlushSeconds); } */ @@ -3079,7 +3034,7 @@ int CClientManager::Process() if (!(thecore_heart->pulse % thecore_heart->passes_per_sec * 10)) { - pt_log("[%9d] return %d/%d/%d/%d async %d/%d/%d/%d", + SPDLOG_TRACE("[{:9}] return {}/{}/{}/{} async {}/{}/{}/{}", thecore_heart->pulse, CDBManager::instance().CountReturnQuery(SQL_PLAYER), CDBManager::instance().CountReturnResult(SQL_PLAYER), @@ -3090,8 +3045,8 @@ int CClientManager::Process() CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER), CDBManager::instance().CountAsyncCopiedQuery(SQL_PLAYER)); - if ((thecore_heart->pulse % 50) == 0) - sys_log(0, "[%9d] return %d/%d/%d async %d/%d/%d", + if ((thecore_heart->pulse % 50) == 0) + SPDLOG_TRACE("[{:9}] return {}/{}/{} async {}/{}/{}", thecore_heart->pulse, CDBManager::instance().CountReturnQuery(SQL_PLAYER), CDBManager::instance().CountReturnResult(SQL_PLAYER), @@ -3103,7 +3058,7 @@ int CClientManager::Process() } else { - pt_log("[%9d] return %d/%d/%d/%d async %d/%d/%d%/%d", + SPDLOG_TRACE("[{:9}] return {}/{}/{}/{} async {}/{}/{}/{}", thecore_heart->pulse, CDBManager::instance().CountReturnQuery(SQL_PLAYER), CDBManager::instance().CountReturnResult(SQL_PLAYER), @@ -3114,16 +3069,16 @@ int CClientManager::Process() CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER), CDBManager::instance().CountAsyncCopiedQuery(SQL_PLAYER)); - if ((thecore_heart->pulse % 50) == 0) - sys_log(0, "[%9d] return %d/%d/%d async %d/%d/%d", - thecore_heart->pulse, - CDBManager::instance().CountReturnQuery(SQL_PLAYER), - CDBManager::instance().CountReturnResult(SQL_PLAYER), - CDBManager::instance().CountReturnQueryFinished(SQL_PLAYER), - CDBManager::instance().CountAsyncQuery(SQL_PLAYER), - CDBManager::instance().CountAsyncResult(SQL_PLAYER), - CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER)); - } + if ((thecore_heart->pulse % 50) == 0) + SPDLOG_TRACE("[{:9}] return {}/{}/{} async {}/{}/{}", + thecore_heart->pulse, + CDBManager::instance().CountReturnQuery(SQL_PLAYER), + CDBManager::instance().CountReturnResult(SQL_PLAYER), + CDBManager::instance().CountReturnQueryFinished(SQL_PLAYER), + CDBManager::instance().CountAsyncQuery(SQL_PLAYER), + CDBManager::instance().CountAsyncResult(SQL_PLAYER), + CDBManager::instance().CountAsyncQueryFinished(SQL_PLAYER)); + } CDBManager::instance().ResetCounter(); @@ -3183,46 +3138,46 @@ int CClientManager::Process() it++; } - pt_log("QUERY:\n%s-------------------- MAX : %d\n", buf, count); + SPDLOG_TRACE("QUERY:\n{}-------------------- MAX : {}", buf, count); g_query_info.Reset(); */ - pt_log("QUERY: MAIN[%d] ASYNC[%d]", g_query_count[0], g_query_count[1]); - g_query_count[0] = 0; - g_query_count[1] = 0; - ///////////////////////////////////////////////////////////////// + SPDLOG_TRACE("QUERY: MAIN[{}] ASYNC[{}]", g_query_count[0], g_query_count[1]); + g_query_count[0] = 0; + g_query_count[1] = 0; + ///////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////// - /* - buf[0] = '\0'; - len = 0; + ///////////////////////////////////////////////////////////////// + /* + buf[0] = '\0'; + len = 0; - it = g_item_info.m_map_info.begin(); + it = g_item_info.m_map_info.begin(); - count = 0; - while (it != g_item_info.m_map_info.end()) - { - len += snprintf(buf + len, sizeof(buf) - len, "%5d %3d\n", it->first, it->second); - count += it->second; - it++; - } + count = 0; + while (it != g_item_info.m_map_info.end()) + { + len += snprintf(buf + len, sizeof(buf) - len, "%5d %3d\n", it->first, it->second); + count += it->second; + it++; + } - pt_log("ITEM:\n%s-------------------- MAX : %d\n", buf, count); - g_item_info.Reset(); - */ - pt_log("ITEM:%d\n", g_item_count); - g_item_count = 0; - ///////////////////////////////////////////////////////////////// - } + SPDLOG_TRACE("ITEM:\n{}-------------------- MAX : {}", buf, count); + g_item_info.Reset(); + */ + SPDLOG_TRACE("ITEM:{}", g_item_count); + g_item_count = 0; + ///////////////////////////////////////////////////////////////// + } - if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 60))) // 60ÃÊ¿¡ Çѹø - { - // À¯´ÏÅ© ¾ÆÀÌÅÛÀ» À§ÇÑ ½Ã°£À» º¸³½´Ù. - CClientManager::instance().SendTime(); - } + if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 60))) // 60ÃÊ¿¡ Çѹø + { + // À¯´ÏÅ© ¾ÆÀÌÅÛÀ» À§ÇÑ ½Ã°£À» º¸³½´Ù. + CClientManager::instance().SendTime(); + } - if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 3600))) // Çѽ𣿡 Çѹø - { - CMoneyLog::instance().Save(); + if (!(thecore_heart->pulse % (thecore_heart->passes_per_sec * 3600))) // Çѽ𣿡 Çѹø + { + CMoneyLog::instance().Save(); } } @@ -3298,19 +3253,19 @@ bool CClientManager::InitializeNowItemID() //¾ÆÀÌÅÛ ID¸¦ ÃʱâÈ­ ÇÑ´Ù. if (!CConfig::instance().GetTwoValue("ITEM_ID_RANGE", &dwMin, &dwMax)) { - sys_err("conf.txt: Cannot find ITEM_ID_RANGE [start_item_id] [end_item_id]"); + SPDLOG_ERROR("conf.txt: Cannot find ITEM_ID_RANGE [start_item_id] [end_item_id]"); return false; } - sys_log(0, "ItemRange From File %u ~ %u ", dwMin, dwMax); + SPDLOG_DEBUG("ItemRange From File {} ~ {} ", dwMin, dwMax); if (CItemIDRangeManager::instance().BuildRange(dwMin, dwMax, m_itemRange) == false) { - sys_err("Can not build ITEM_ID_RANGE"); + SPDLOG_ERROR("Can not build ITEM_ID_RANGE"); return false; } - sys_log(0, " Init Success Start %u End %u Now %u\n", m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); + SPDLOG_DEBUG(" Init Success Start {} End {} Now {}", m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); return true; } @@ -3335,12 +3290,12 @@ bool CClientManager::InitializeLocalization() if (pMsg->Get()->uiNumRows == 0) { - sys_err("InitializeLocalization() ==> DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR("InitializeLocalization() ==> DirectQuery failed({})", szQuery); delete pMsg; return false; } - sys_log(0, "InitializeLocalization() - LoadLocaleTable(count:%d)", pMsg->Get()->uiNumRows); + SPDLOG_DEBUG("InitializeLocalization() - LoadLocaleTable(count:{})", pMsg->Get()->uiNumRows); m_vec_Locale.clear(); @@ -3359,346 +3314,346 @@ bool CClientManager::InitializeLocalization() { if (strcmp(locale.szValue, "cibn") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "gb2312"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "gb2312"); g_stLocale = "gb2312"; g_stLocaleNameColumn = "gb2312name"; } else if (strcmp(locale.szValue, "ymir") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "euckr"; g_stLocaleNameColumn = "name"; } else if (strcmp(locale.szValue, "japan") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "sjis"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "sjis"); g_stLocale = "sjis"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "english") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = ""; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "germany") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "france") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "italy") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "spain") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "uk") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "turkey") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin5"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "poland") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "portugal") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "hongkong") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "big5"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "big5"); g_stLocale = "big5"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "newcibn") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "gb2312"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "gb2312"); g_stLocale = "gb2312"; g_stLocaleNameColumn = "gb2312name"; } else if (strcmp(locale.szValue, "korea") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "euckr"; g_stLocaleNameColumn = "name"; } else if (strcmp(locale.szValue, "canada") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "gb2312name"; } else if (strcmp(locale.szValue, "brazil") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "greek") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "greek"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "russia") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "cp1251"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "denmark") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "bulgaria") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "cp1251"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "croatia") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "cp1251"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "mexico") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "arabia") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "cp1256"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "czech") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "hungary") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "romania") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin2"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "netherlands") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "singapore") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "vietnam") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "thailand") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "usa") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "latin1"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "latin1"); g_stLocale = "latin1"; g_stLocaleNameColumn = "locale_name"; } else if (strcmp(locale.szValue, "we_korea") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "euckr"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "euckr"); g_stLocale = "euckr"; g_stLocaleNameColumn = "name"; } else if (strcmp(locale.szValue, "taiwan") == 0) { - sys_log(0, "locale[LOCALE] = %s", locale.szValue); + SPDLOG_DEBUG("locale[LOCALE] = {}", locale.szValue); if (g_stLocale != locale.szValue) - sys_log(0, "Changed g_stLocale %s to %s", g_stLocale.c_str(), "big5"); + SPDLOG_DEBUG("Changed g_stLocale {} to {}", g_stLocale.c_str(), "big5"); g_stLocale = "big5"; g_stLocaleNameColumn = "locale_name"; } else { - sys_err("locale[LOCALE] = UNKNOWN(%s)", locale.szValue); + SPDLOG_ERROR("locale[LOCALE] = UNKNOWN({})", locale.szValue); exit(0); } @@ -3706,12 +3661,12 @@ bool CClientManager::InitializeLocalization() } else if (strcmp(locale.szKey, "DB_NAME_COLUMN") == 0) { - sys_log(0, "locale[DB_NAME_COLUMN] = %s", locale.szValue); + SPDLOG_DEBUG("locale[DB_NAME_COLUMN] = {}", locale.szValue); g_stLocaleNameColumn = locale.szValue; } else { - sys_log(0, "locale[UNKNOWN_KEY(%s)] = %s", locale.szKey, locale.szValue); + SPDLOG_DEBUG("locale[UNKNOWN_KEY({})] = {}", locale.szKey, locale.szValue); } m_vec_Locale.push_back(locale); } @@ -3735,7 +3690,7 @@ bool CClientManager::__GetAdminInfo(const char *szIP, std::vector & if (pMsg->Get()->uiNumRows == 0) { - sys_err("__GetAdminInfo() ==> DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR("__GetAdminInfo() ==> DirectQuery failed({})", szQuery); delete pMsg; return false; } @@ -3770,7 +3725,7 @@ bool CClientManager::__GetAdminInfo(const char *szIP, std::vector & rAdminVec.push_back(Info); - sys_log(0, "GM: PID %u Login %s Character %s ContactIP %s ServerIP %s Authority %d[%s]", + SPDLOG_DEBUG("GM: PID {} Login {} Character {} ContactIP {} ServerIP {} Authority {}[{}]", Info.m_ID, Info.m_szAccount, Info.m_szName, Info.m_szContactIP, Info.m_szServerIP, Info.m_Authority, stAuth.c_str()); } @@ -3787,7 +3742,7 @@ bool CClientManager::__GetHostInfo(std::vector & rIPVec) if (pMsg->Get()->uiNumRows == 0) { - sys_err("__GetHostInfo() ==> DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR("__GetHostInfo() ==> DirectQuery failed({})", szQuery); delete pMsg; return false; } @@ -3801,7 +3756,7 @@ bool CClientManager::__GetHostInfo(std::vector & rIPVec) if (row[0] && *row[0]) { rIPVec.push_back(row[0]); - sys_log(0, "GMHOST: %s", row[0]); + SPDLOG_DEBUG("GMHOST: {}", row[0]); } } @@ -3843,7 +3798,7 @@ void CClientManager::ReloadAdmin(CPeer*, TPacketReloadAdmin* p) peer->Encode(&vAdmin[n], sizeof(tAdminInfo)); } - sys_log(0, "ReloadAdmin End %s", p->szIP); + SPDLOG_DEBUG("ReloadAdmin End {}", p->szIP); } //BREAK_MARRIAGE @@ -3857,7 +3812,7 @@ void CClientManager::BreakMarriage(CPeer * peer, const char * data) pid2 = *(int *) data; data += sizeof(int); - sys_log(0, "Breaking off a marriage engagement! pid %d and pid %d", pid1, pid2); + SPDLOG_DEBUG("Breaking off a marriage engagement! pid {} and pid {}", pid1, pid2); marriage::CManager::instance().Remove(pid1, pid2); } //END_BREAK_MARIIAGE @@ -3868,8 +3823,7 @@ void CClientManager::UpdateItemCacheSet(DWORD pid) if (it == m_map_pkItemCacheSetPtr.end()) { - if (g_test_server) - sys_log(0, "UPDATE_ITEMCACHESET : UpdateItemCacheSet ==> No ItemCacheSet pid(%d)", pid); + SPDLOG_TRACE("UPDATE_ITEMCACHESET : UpdateItemCacheSet ==> No ItemCacheSet pid({})", pid); return; } @@ -3882,8 +3836,7 @@ void CClientManager::UpdateItemCacheSet(DWORD pid) c->Flush(); } - if (g_log) - sys_log(0, "UPDATE_ITEMCACHESET : UpdateItemCachsSet pid(%d)", pid); + SPDLOG_TRACE("UPDATE_ITEMCACHESET : UpdateItemCachsSet pid({})", pid); } void CClientManager::Election(CPeer * peer, DWORD dwHandle, const char* data) @@ -3901,16 +3854,14 @@ void CClientManager::Election(CPeer * peer, DWORD dwHandle, const char* data) if (!(Success = CMonarch::instance().VoteMonarch(selectingpid, idx))) { - if (g_test_server) - sys_log(0, "[MONARCH_VOTE] Failed %d %d", idx, selectingpid); + SPDLOG_TRACE("[MONARCH_VOTE] Failed {} {}", idx, selectingpid); peer->EncodeHeader(HEADER_DG_ELECT_MONARCH, dwHandle, sizeof(int)); peer->Encode(&Success, sizeof(int)); return; } else { - if (g_test_server) - sys_log(0, "[MONARCH_VOTE] Success %d %d", idx, selectingpid); + SPDLOG_TRACE("[MONARCH_VOTE] Success {} {}", idx, selectingpid); peer->EncodeHeader(HEADER_DG_ELECT_MONARCH, dwHandle, sizeof(int)); peer->Encode(&Success, sizeof(int)); return; @@ -3926,8 +3877,7 @@ void CClientManager::Candidacy(CPeer * peer, DWORD dwHandle, const char* data) if (!CMonarch::instance().AddCandidacy(pid, data)) { - if (g_test_server) - sys_log(0, "[MONARCH_CANDIDACY] Failed %d %s", pid, data); + SPDLOG_TRACE("[MONARCH_CANDIDACY] Failed {} {}", pid, data); peer->EncodeHeader(HEADER_DG_CANDIDACY, dwHandle, sizeof(int) + 32); peer->Encode(0, sizeof(int)); @@ -3936,8 +3886,7 @@ void CClientManager::Candidacy(CPeer * peer, DWORD dwHandle, const char* data) } else { - if (g_test_server) - sys_log(0, "[MONARCH_CANDIDACY] Success %d %s", pid, data); + SPDLOG_TRACE("[MONARCH_CANDIDACY] Success {} {}", pid, data); for (itertype(m_peerList) it = m_peerList.begin(); it != m_peerList.end(); ++it) { @@ -3973,8 +3922,7 @@ void CClientManager::AddMonarchMoney(CPeer * peer, DWORD dwHandle, const char * int Money = *(int *) data; data += sizeof(int); - if (g_test_server) - sys_log(0, "[MONARCH] Add money Empire(%d) Money(%d)", Empire, Money); + SPDLOG_TRACE("[MONARCH] Add money Empire({}) Money({})", Empire, Money); CMonarch::instance().AddMoney(Empire, Money); @@ -4008,8 +3956,7 @@ void CClientManager::DecMonarchMoney(CPeer * peer, DWORD dwHandle, const char * int Money = *(int *) data; data += sizeof(int); - if (g_test_server) - sys_log(0, "[MONARCH] Dec money Empire(%d) Money(%d)", Empire, Money); + SPDLOG_TRACE("[MONARCH] Dec money Empire({}) Money({})", Empire, Money); CMonarch::instance().DecMoney(Empire, Money); @@ -4046,8 +3993,7 @@ void CClientManager::TakeMonarchMoney(CPeer * peer, DWORD dwHandle, const char * int Money = *(int *) data; data += sizeof(int); - if (g_test_server) - sys_log(0, "[MONARCH] Take money Empire(%d) Money(%d)", Empire, Money); + SPDLOG_TRACE("[MONARCH] Take money Empire({}) Money({})", Empire, Money); if (CMonarch::instance().TakeMoney(Empire, pid, Money) == true) { @@ -4074,7 +4020,7 @@ void CClientManager::RMCandidacy(CPeer * peer, DWORD dwHandle, const char * data char szName[32]; strlcpy(szName, data, sizeof(szName)); - sys_log(0, "[MONARCH_GM] Remove candidacy name(%s)", szName); + SPDLOG_DEBUG("[MONARCH_GM] Remove candidacy name({})", szName); int iRet = CMonarch::instance().DelCandidacy(szName) ? 1 : 0; @@ -4116,8 +4062,7 @@ void CClientManager::SetMonarch(CPeer * peer, DWORD dwHandle, const char * data) strlcpy(szName, data, sizeof(szName)); - if (g_test_server) - sys_log(0, "[MONARCH_GM] Set Monarch name(%s)", szName); + SPDLOG_TRACE("[MONARCH_GM] Set Monarch name({})", szName); int iRet = CMonarch::instance().SetMonarch(szName) ? 1 : 0; @@ -4159,8 +4104,7 @@ void CClientManager::RMMonarch(CPeer * peer, DWORD dwHandle, const char * data) strlcpy(szName, data, sizeof(szName)); - if (g_test_server) - sys_log(0, "[MONARCH_GM] Remove Monarch name(%s)", szName); + SPDLOG_TRACE("[MONARCH_GM] Remove Monarch name({})", szName); CMonarch::instance().DelMonarch(szName); @@ -4248,7 +4192,7 @@ void CClientManager::ChangeMonarchLord(CPeer * peer, DWORD dwHandle, TPacketChan void CClientManager::BlockException(TPacketBlockException *data) { - sys_log(0, "[BLOCK_EXCEPTION] CMD(%d) login(%s)", data->cmd, data->login); + SPDLOG_DEBUG("[BLOCK_EXCEPTION] CMD({}) login({})", data->cmd, data->login); // save sql { @@ -4310,19 +4254,19 @@ void CClientManager::DeleteLoginKey(TPacketDC *data) // delete gift notify icon void CClientManager::DeleteAwardId(TPacketDeleteAwardID *data) { - //sys_log(0,"data from game server arrived %d",data->dwID); + //SPDLOG_DEBUG("data from game server arrived {}", data->dwID); std::map::iterator it; it = ItemAwardManager::Instance().GetMapAward().find(data->dwID); if ( it != ItemAwardManager::Instance().GetMapAward().end() ) { std::set & kSet = ItemAwardManager::Instance().GetMapkSetAwardByLogin()[it->second->szLogin]; if(kSet.erase(it->second)) - sys_log(0,"erase ItemAward id: %d from cache", data->dwID); + SPDLOG_DEBUG("erase ItemAward id: {} from cache", data->dwID); ItemAwardManager::Instance().GetMapAward().erase(data->dwID); } else { - sys_log(0,"DELETE_AWARDID : could not find the id: %d", data->dwID); + SPDLOG_DEBUG("DELETE_AWARDID : could not find the id: {}", data->dwID); } } @@ -4369,11 +4313,11 @@ void CClientManager::ChargeCash(const TRequestChargeCash* packet) sprintf(szQuery, "update account set `mileage` = `mileage` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID); else { - sys_err ("Invalid request charge type (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID); + SPDLOG_ERROR("Invalid request charge type (type : {}, amount : {}, aid : {})", (int) packet->eChargeType, packet->dwAmount, packet->dwAID); return; } - sys_err ("Request Charge (type : %d, amount : %d, aid : %d)", packet->eChargeType, packet->dwAmount, packet->dwAID); + SPDLOG_ERROR("Request Charge (type : {}, amount : {}, aid : {})", (int) packet->eChargeType, packet->dwAmount, packet->dwAID); CDBManager::Instance().AsyncQuery(szQuery, SQL_ACCOUNT); } @@ -4385,21 +4329,21 @@ void CClientManager::EnrollInAuction (CPeer * peer, DWORD owner_id, AuctionEnrol if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", owner_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", owner_id); return; } CItemCache* c = GetItemCache (data->get_item_id()); if (c == NULL) { - sys_err ("Item %d doesn't exist in db cache.", data->get_item_id()); + SPDLOG_ERROR("Item {} doesn't exist in db cache.", data->get_item_id()); return; } TPlayerItem* item = c->Get(false); if (item->owner != owner_id) { - sys_err ("Player id %d doesn't have item %d.", owner_id, data->get_item_id()); + SPDLOG_ERROR("Player id {} doesn't have item {}.", owner_id, data->get_item_id()); return; } // ÇöÀç ½Ã°¢ + 24½Ã°£ ÈÄ. @@ -4429,7 +4373,7 @@ void CClientManager::EnrollInAuction (CPeer * peer, DWORD owner_id, AuctionEnrol it->second->erase(c); } m_map_itemCache.erase(item->id); - sys_log(0, "Enroll In Auction Success. owner_id item_id %d %d", owner_id, item->id); + SPDLOG_DEBUG("Enroll In Auction Success. owner_id item_id {} {}", owner_id, item->id); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_AUC; @@ -4453,7 +4397,7 @@ void CClientManager::EnrollInSale (CPeer * peer, DWORD owner_id, AuctionEnrollSa if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", owner_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", owner_id); return; } @@ -4464,14 +4408,14 @@ void CClientManager::EnrollInSale (CPeer * peer, DWORD owner_id, AuctionEnrollSa if (c == NULL) { - sys_err ("Item %d doesn't exist in db cache.", data->get_item_id()); + SPDLOG_ERROR("Item {} doesn't exist in db cache.", data->get_item_id()); return; } TPlayerItem* item = c->Get(false); if (item->owner != owner_id) { - sys_err ("Player id %d doesn't have item %d.", owner_id, data->get_item_id()); + SPDLOG_ERROR("Player id {} doesn't have item {}.", owner_id, data->get_item_id()); return; } // ÇöÀç ½Ã°¢ + 24½Ã°£ ÈÄ. @@ -4501,7 +4445,7 @@ void CClientManager::EnrollInSale (CPeer * peer, DWORD owner_id, AuctionEnrollSa it->second->erase(c); } m_map_itemCache.erase(item->id); - sys_log(0, "Enroll In Sale Success. owner_id item_id %d %d", owner_id, item->id); + SPDLOG_DEBUG("Enroll In Sale Success. owner_id item_id {} {}", owner_id, item->id); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_SALE; @@ -4526,7 +4470,7 @@ void CClientManager::EnrollInWish (CPeer * peer, DWORD wisher_id, AuctionEnrollW if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", wisher_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", wisher_id); return; } @@ -4541,7 +4485,7 @@ void CClientManager::EnrollInWish (CPeer * peer, DWORD wisher_id, AuctionEnrollW if (result <= AUCTION_FAIL) { - sys_log(0, "Enroll In Wish Success. wisher_id item_num %d %d", wisher_id, data->get_item_num()); + SPDLOG_DEBUG("Enroll In Wish Success. wisher_id item_num {} {}", wisher_id, data->get_item_num()); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_WISH; @@ -4552,7 +4496,7 @@ void CClientManager::EnrollInWish (CPeer * peer, DWORD wisher_id, AuctionEnrollW } else { - sys_log(0, "Enroll In Wish Fail. wisher_id item_num %d %d", wisher_id, data->get_item_num()); + SPDLOG_DEBUG("Enroll In Wish Fail. wisher_id item_num {} {}", wisher_id, data->get_item_num()); TPacketDGResultAuction enroll_result; enroll_result.cmd = AUCTION_ENR_WISH; @@ -4576,7 +4520,7 @@ void CClientManager::AuctionBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo* if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", bidder_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", bidder_id); return; } @@ -4587,11 +4531,11 @@ void CClientManager::AuctionBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo* if (result == AUCTION_FAIL) { - sys_log(0, "Bid Fail. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("Bid Fail. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } else { - sys_log(0, "Bid Success. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("Bid Success. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } if (result <= AUCTION_FAIL) @@ -4630,7 +4574,7 @@ void CClientManager::AuctionImpur (CPeer * peer, DWORD purchaser_id, AuctionImpu if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", purchaser_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", purchaser_id); return; } @@ -4641,11 +4585,11 @@ void CClientManager::AuctionImpur (CPeer * peer, DWORD purchaser_id, AuctionImpu if (result == AUCTION_FAIL) { - sys_log(0, "Impur Fail. purchaser_id item_id %d %d", purchaser_id, data->get_item_id()); + SPDLOG_DEBUG("Impur Fail. purchaser_id item_id {} {}", purchaser_id, data->get_item_id()); } else { - sys_log(0, "Impur Success. purchaser_id item_id %d %d", purchaser_id, data->get_item_id()); + SPDLOG_DEBUG("Impur Success. purchaser_id item_id {} {}", purchaser_id, data->get_item_id()); } if (result <= AUCTION_FAIL) @@ -4682,7 +4626,7 @@ void CClientManager::AuctionGetAuctionedItem (CPeer * peer, DWORD actor_id, DWOR AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4722,7 +4666,7 @@ void CClientManager::AuctionBuySoldItem (CPeer * peer, DWORD actor_id, DWORD ite AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4762,7 +4706,7 @@ void CClientManager::AuctionCancelAuction (CPeer * peer, DWORD actor_id, DWORD i AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4802,7 +4746,7 @@ void CClientManager::AuctionCancelWish (CPeer * peer, DWORD actor_id, DWORD item AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4841,7 +4785,7 @@ void CClientManager::AuctionCancelSale (CPeer * peer, DWORD actor_id, DWORD item AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4881,7 +4825,7 @@ void CClientManager::AuctionDeleteAuctionItem (CPeer * peer, DWORD actor_id, DWO AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4893,7 +4837,7 @@ void CClientManager::AuctionDeleteSaleItem (CPeer * peer, DWORD actor_id, DWORD AuctionResult result = AUCTION_FAIL; if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", actor_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", actor_id); return; } @@ -4912,7 +4856,7 @@ void CClientManager::AuctionReBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo if (it == m_map_playerCache.end()) { - sys_err ("Invalid Player id %d. how can you get it?", bidder_id); + SPDLOG_ERROR("Invalid Player id {}. how can you get it?", bidder_id); return; } @@ -4923,11 +4867,11 @@ void CClientManager::AuctionReBid (CPeer * peer, DWORD bidder_id, AuctionBidInfo if (result == AUCTION_FAIL) { - sys_log(0, "ReBid Fail. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("ReBid Fail. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } else { - sys_log(0, "ReBid Success. bidder_id item_id %d %d", bidder_id, data->get_item_id()); + SPDLOG_DEBUG("ReBid Success. bidder_id item_id {} {}", bidder_id, data->get_item_id()); } // ÀÌ°Ç FAILÀÌ ¶°¼­´Â ¾ÈµÅ. // FAILÀÌ ¶ã ¼ö°¡ ¾ø´Â°Ô, MyBid¿¡ ÀÖ´Â bidder_id¿¡ ´ëÇÑ ÄÁÅÙÃ÷´Â bidder_id¸¸ÀÌ Á¢±Ù ÇÒ ¼ö Àְŵç? diff --git a/src/db/src/ClientManagerBoot.cpp b/src/db/src/ClientManagerBoot.cpp index c52b97d..3b410ae 100644 --- a/src/db/src/ClientManagerBoot.cpp +++ b/src/db/src/ClientManagerBoot.cpp @@ -16,84 +16,84 @@ bool CClientManager::InitializeTables() { if (!InitializeMobTable()) { - sys_err("InitializeMobTable FAILED"); + SPDLOG_ERROR("InitializeMobTable FAILED"); return false; } if (!MirrorMobTableIntoDB()) { - sys_err("MirrorMobTableIntoDB FAILED"); + SPDLOG_ERROR("MirrorMobTableIntoDB FAILED"); return false; } if (!InitializeItemTable()) { - sys_err("InitializeItemTable FAILED"); + SPDLOG_ERROR("InitializeItemTable FAILED"); return false; } if (!MirrorItemTableIntoDB()) { - sys_err("MirrorItemTableIntoDB FAILED"); + SPDLOG_ERROR("MirrorItemTableIntoDB FAILED"); return false; } if (!InitializeShopTable()) { - sys_err("InitializeShopTable FAILED"); + SPDLOG_ERROR("InitializeShopTable FAILED"); return false; } if (!InitializeSkillTable()) { - sys_err("InitializeSkillTable FAILED"); + SPDLOG_ERROR("InitializeSkillTable FAILED"); return false; } if (!InitializeRefineTable()) { - sys_err("InitializeRefineTable FAILED"); + SPDLOG_ERROR("InitializeRefineTable FAILED"); return false; } if (!InitializeItemAttrTable()) { - sys_err("InitializeItemAttrTable FAILED"); + SPDLOG_ERROR("InitializeItemAttrTable FAILED"); return false; } if (!InitializeItemRareTable()) { - sys_err("InitializeItemRareTable FAILED"); + SPDLOG_ERROR("InitializeItemRareTable FAILED"); return false; } if (!InitializeBanwordTable()) { - sys_err("InitializeBanwordTable FAILED"); + SPDLOG_ERROR("InitializeBanwordTable FAILED"); return false; } if (!InitializeLandTable()) { - sys_err("InitializeLandTable FAILED"); + SPDLOG_ERROR("InitializeLandTable FAILED"); return false; } if (!InitializeObjectProto()) { - sys_err("InitializeObjectProto FAILED"); + SPDLOG_ERROR("InitializeObjectProto FAILED"); return false; } if (!InitializeObjectTable()) { - sys_err("InitializeObjectTable FAILED"); + SPDLOG_ERROR("InitializeObjectTable FAILED"); return false; } if (!InitializeMonarch()) { - sys_err("InitializeMonarch FAILED"); + SPDLOG_ERROR("InitializeMonarch FAILED"); return false; } @@ -117,7 +117,7 @@ bool CClientManager::InitializeRefineTable() if (m_pRefineTable) { - sys_log(0, "RELOAD: refine_proto"); + SPDLOG_DEBUG("RELOAD: refine_proto"); delete [] m_pRefineTable; m_pRefineTable = NULL; } @@ -153,7 +153,7 @@ bool CClientManager::InitializeRefineTable() } } - sys_log(0, "REFINE: id %ld cost %d prob %d mat1 %lu cnt1 %d", prt->id, prt->cost, prt->prob, prt->materials[0].vnum, prt->materials[0].count); + SPDLOG_TRACE("REFINE: id {} cost {} prob {} mat1 {} cnt1 {}", prt->id, prt->cost, prt->prob, prt->materials[0].vnum, prt->materials[0].count); prt++; } @@ -203,7 +203,7 @@ bool CClientManager::InitializeMobTable() cCsvTable nameData; if(!nameData.Load("mob_names.txt",'\t')) { - fprintf(stderr, "mob_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("mob_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); isNameFile = false; } else { nameData.Next(); //¼³¸írow »ý·«. @@ -224,7 +224,7 @@ bool CClientManager::InitializeMobTable() cCsvTable test_data; if(!test_data.Load("mob_proto_test.txt",'\t')) { - fprintf(stderr, "Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù.\n"); + SPDLOG_ERROR("Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù."); isTestFile = false; } //2. (c)[test_map_mobTableByVnum](vnum:TMobTable) ¸Ê »ý¼º. @@ -243,7 +243,7 @@ bool CClientManager::InitializeMobTable() if (!Set_Proto_Mob_Table(test_mob_table, test_data, localMap)) { - fprintf(stderr, "¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } test_map_mobTableByVnum.insert(std::map::value_type(test_mob_table->dwVnum, test_mob_table)); @@ -264,7 +264,7 @@ bool CClientManager::InitializeMobTable() //1. ÆÄÀÏ Àбâ. cCsvTable data; if(!data.Load("mob_proto.txt",'\t')) { - fprintf(stderr, "mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¼³¸í row ³Ñ¾î°¡±â @@ -283,14 +283,14 @@ bool CClientManager::InitializeMobTable() data.Destroy(); if(!data.Load("mob_proto.txt",'\t')) { - fprintf(stderr, "mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("mob_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ) //2.2 Å©±â¿¡ ¸Â°Ô mob_table »ý¼º if (!m_vec_mobTable.empty()) { - sys_log(0, "RELOAD: mob_proto"); + SPDLOG_DEBUG("RELOAD: mob_proto"); m_vec_mobTable.clear(); } m_vec_mobTable.resize(data.m_File.GetRowCount()-1 + addNumber); @@ -378,7 +378,7 @@ bool CClientManager::InitializeMobTable() if (!Set_Proto_Mob_Table(mob_table, data, localMap)) { - fprintf(stderr, "¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } @@ -388,7 +388,7 @@ bool CClientManager::InitializeMobTable() vnumSet.insert(mob_table->dwVnum); - sys_log(1, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); + SPDLOG_TRACE("MOB #{:<5} {:24} {:24} level: {:<3} rank: {} empire: {}", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); ++mob_table; } @@ -402,7 +402,7 @@ bool CClientManager::InitializeMobTable() test_data; if(!test_data.Load("mob_proto_test.txt",'\t')) { - fprintf(stderr, "Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù.\n"); + SPDLOG_ERROR("Å×½ºÆ® ÆÄÀÏÀÌ ¾ø½À´Ï´Ù. ±×´ë·Î ÁøÇàÇÕ´Ï´Ù."); isTestFile = false; } if(isTestFile) { @@ -419,10 +419,10 @@ bool CClientManager::InitializeMobTable() if (!Set_Proto_Mob_Table(mob_table, test_data, localMap)) { - fprintf(stderr, "¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¸÷ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } - sys_log(0, "MOB #%-5d %-24s %-24s level: %-3u rank: %u empire: %d", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); + SPDLOG_DEBUG("MOB #{:<5} {:24} {:24} level: {:<3} rank: {} empire: {}", mob_table->dwVnum, mob_table->szName, mob_table->szLocaleName, mob_table->bLevel, mob_table->bRank, mob_table->bEmpire); ++mob_table; } @@ -453,7 +453,7 @@ bool CClientManager::InitializeShopTable() if (!pRes2->uiNumRows) { - sys_err("InitializeShopTable : Table count is zero."); + SPDLOG_ERROR("InitializeShopTable : Table count is zero."); return false; } @@ -508,7 +508,7 @@ bool CClientManager::InitializeShopTable() while (it != map_shop.end()) { memcpy((m_pShopTable + i), (it++)->second, sizeof(TShopTable)); - sys_log(0, "SHOP: #%d items: %d", (m_pShopTable + i)->dwVnum, (m_pShopTable + i)->byItemCount); + SPDLOG_DEBUG("SHOP: #{} items: {}", (m_pShopTable + i)->dwVnum, (m_pShopTable + i)->byItemCount); ++i; } @@ -529,7 +529,7 @@ bool CClientManager::InitializeQuestItemTable() if (!pRes->uiNumRows) { - sys_err("query error or no rows: %s", query); + SPDLOG_ERROR("query error or no rows: {}", query); return false; } @@ -556,7 +556,7 @@ bool CClientManager::InitializeQuestItemTable() if (m_map_itemTableByVnum.find(tbl.dwVnum) != m_map_itemTableByVnum.end()) { - sys_err("QUEST_ITEM_ERROR! %lu vnum already exist! (name %s)", tbl.dwVnum, tbl.szLocaleName); + SPDLOG_ERROR("QUEST_ITEM_ERROR! {} vnum already exist! (name {})", tbl.dwVnum, tbl.szLocaleName); continue; } @@ -603,7 +603,7 @@ bool CClientManager::InitializeItemTable() cCsvTable nameData; if(!nameData.Load("item_names.txt",'\t')) { - fprintf(stderr, "item_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_names.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); isNameFile = false; } else { nameData.Next(); @@ -622,7 +622,7 @@ bool CClientManager::InitializeItemTable() cCsvTable test_data; if(!test_data.Load("item_proto_test.txt",'\t')) { - fprintf(stderr, "item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); //return false; } else { test_data.Next(); //¼³¸í ·Î¿ì ³Ñ¾î°¡±â. @@ -639,7 +639,7 @@ bool CClientManager::InitializeItemTable() if (!Set_Proto_Item_Table(test_item_table, test_data, localMap)) { - fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } test_map_itemTableByVnum.insert(std::map::value_type(test_item_table->dwVnum, test_item_table)); @@ -666,14 +666,14 @@ bool CClientManager::InitializeItemTable() cCsvTable data; if(!data.Load("item_proto.txt",'\t')) { - fprintf(stderr, "item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ) if (!m_vec_itemTable.empty()) { - sys_log(0, "RELOAD: item_proto"); + SPDLOG_DEBUG("RELOAD: item_proto"); m_vec_itemTable.clear(); m_map_itemTableByVnum.clear(); } @@ -693,7 +693,7 @@ bool CClientManager::InitializeItemTable() data.Destroy(); if(!data.Load("item_proto.txt",'\t')) { - fprintf(stderr, "item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); return false; } data.Next(); //¸Ç À­ÁÙ Á¦¿Ü (¾ÆÀÌÅÛ Ä®·³À» ¼³¸íÇÏ´Â ºÎºÐ) @@ -715,7 +715,7 @@ bool CClientManager::InitializeItemTable() if (!Set_Proto_Item_Table(item_table, data, localMap)) { - fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } @@ -782,7 +782,7 @@ bool CClientManager::InitializeItemTable() test_data.Destroy(); if(!test_data.Load("item_proto_test.txt",'\t')) { - fprintf(stderr, "item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù\n"); + SPDLOG_ERROR("item_proto_test.txt ÆÄÀÏÀ» Àоî¿ÀÁö ¸øÇß½À´Ï´Ù"); //return false; } else { test_data.Next(); //¼³¸í ·Î¿ì ³Ñ¾î°¡±â. @@ -798,7 +798,7 @@ bool CClientManager::InitializeItemTable() if (!Set_Proto_Item_Table(item_table, test_data, localMap)) { - fprintf(stderr, "¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ.\n"); + SPDLOG_ERROR("¾ÆÀÌÅÛ ÇÁ·ÎÅä Å×ÀÌºí ¼ÂÆà ½ÇÆÐ."); } @@ -823,7 +823,7 @@ bool CClientManager::InitializeItemTable() { TItemTable * item_table = &(*(it++)); - sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u", + SPDLOG_TRACE("ITEM: #{:<5} {:24} {:24} VAL: {} {} {} {} {} {} WEAR {} ANTI {} IMMUNE {} REFINE {} REFINE_SET {} MAGIC_PCT {}", item_table->dwVnum, item_table->szName, item_table->szLocaleName, @@ -865,13 +865,13 @@ bool CClientManager::InitializeSkillTable() if (!pRes->uiNumRows) { - sys_err("no result from skill_proto"); + SPDLOG_ERROR("no result from skill_proto"); return false; } if (!m_vec_skillTable.empty()) { - sys_log(0, "RELOAD: skill_proto"); + SPDLOG_DEBUG("RELOAD: skill_proto"); m_vec_skillTable.clear(); } @@ -929,7 +929,7 @@ bool CClientManager::InitializeSkillTable() str_to_number(t.bSkillAttrType, data[col++]); str_to_number(t.dwTargetRange, data[col++]); - sys_log(0, "SKILL: #%d %s flag %u point %s affect %u cooldown %s", t.dwVnum, t.szName, t.dwFlag, t.szPointOn, t.dwAffectFlag, t.szCooldownPoly); + SPDLOG_TRACE("SKILL: #{} {} flag {} point {} affect {} cooldown {}", t.dwVnum, t.szName, t.dwFlag, t.szPointOn, t.dwAffectFlag, t.szCooldownPoly); m_vec_skillTable.push_back(t); } @@ -961,7 +961,7 @@ bool CClientManager::InitializeBanwordTable() } } - sys_log(0, "BANWORD: total %d", m_vec_banwordTable.size()); + SPDLOG_DEBUG("BANWORD: total {}", m_vec_banwordTable.size()); return true; } @@ -977,13 +977,13 @@ bool CClientManager::InitializeItemAttrTable() if (!pRes->uiNumRows) { - sys_err("no result from item_attr"); + SPDLOG_ERROR("no result from item_attr"); return false; } if (!m_vec_itemAttrTable.empty()) { - sys_log(0, "RELOAD: item_attr"); + SPDLOG_DEBUG("RELOAD: item_attr"); m_vec_itemAttrTable.clear(); } @@ -1016,7 +1016,7 @@ bool CClientManager::InitializeItemAttrTable() str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_SHIELD], data[col++]); str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_EAR], data[col++]); - sys_log(0, "ITEM_ATTR: %-20s %4lu { %3d %3d %3d %3d %3d } { %d %d %d %d %d %d %d }", + SPDLOG_TRACE("ITEM_ATTR: {:20} {:4} ( {:3} {:3} {:3} {:3} {:3} ) ( {} {} {} {} {} {} {} )", t.szApply, t.dwProb, t.lValues[0], @@ -1051,13 +1051,13 @@ bool CClientManager::InitializeItemRareTable() if (!pRes->uiNumRows) { - sys_err("no result from item_attr_rare"); + SPDLOG_ERROR("no result from item_attr_rare"); return false; } if (!m_vec_itemRareTable.empty()) { - sys_log(0, "RELOAD: item_attr_rare"); + SPDLOG_DEBUG("RELOAD: item_attr_rare"); m_vec_itemRareTable.clear(); } @@ -1090,7 +1090,7 @@ bool CClientManager::InitializeItemRareTable() str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_SHIELD], data[col++]); str_to_number(t.bMaxLevelBySet[ATTRIBUTE_SET_EAR], data[col++]); - sys_log(0, "ITEM_RARE: %-20s %4lu { %3d %3d %3d %3d %3d } { %d %d %d %d %d %d %d }", + SPDLOG_TRACE("ITEM_RARE: {:20} {:4} ( {:3} {:3} {:3} {:3} {:3} ) ( {} {} {} {} {} {} {} )", t.szApply, t.dwProb, t.lValues[0], @@ -1129,7 +1129,7 @@ bool CClientManager::InitializeLandTable() if (!m_vec_kLandTable.empty()) { - sys_log(0, "RELOAD: land"); + SPDLOG_DEBUG("RELOAD: land"); m_vec_kLandTable.clear(); } @@ -1156,7 +1156,7 @@ bool CClientManager::InitializeLandTable() str_to_number(t.bGuildLevelLimit, data[col++]); str_to_number(t.dwPrice, data[col++]); - sys_log(0, "LAND: %lu map %-4ld %7ldx%-7ld w %-4ld h %-4ld", t.dwID, t.lMapIndex, t.x, t.y, t.width, t.height); + SPDLOG_TRACE("LAND: {} map {:<4} {:7}x{:<7} w {:<4} h {:<4}", t.dwID, t.lMapIndex, t.x, t.y, t.width, t.height); m_vec_kLandTable.push_back(t); } @@ -1232,7 +1232,7 @@ bool CClientManager::InitializeObjectProto() if (!m_vec_kObjectProto.empty()) { - sys_log(0, "RELOAD: object_proto"); + SPDLOG_DEBUG("RELOAD: object_proto"); m_vec_kObjectProto.clear(); } @@ -1280,7 +1280,7 @@ bool CClientManager::InitializeObjectProto() t.lNPCY = std::max(t.lRegion[1], t.lRegion[3])+300; // END_OF_ADD_BUILDING_NPC - sys_log(0, "OBJ_PROTO: vnum %lu price %lu mat %lu %lu", + SPDLOG_TRACE("OBJ_PROTO: vnum {} price {} mat {} {}", t.dwVnum, t.dwPrice, t.kMaterials[0].dwItemVnum, t.kMaterials[0].dwCount); m_vec_kObjectProto.push_back(t); @@ -1301,7 +1301,7 @@ bool CClientManager::InitializeObjectTable() if (!m_map_pkObjectTable.empty()) { - sys_log(0, "RELOAD: object"); + SPDLOG_DEBUG("RELOAD: object"); m_map_pkObjectTable.clear(); } @@ -1327,7 +1327,7 @@ bool CClientManager::InitializeObjectTable() str_to_number(k->zRot, data[col++]); str_to_number(k->lLife, data[col++]); - sys_log(0, "OBJ: %lu vnum %lu map %-4ld %7ldx%-7ld life %ld", + SPDLOG_DEBUG("OBJ: {} vnum {} map {:<4} {:7}x{:<7} life {}", k->dwID, k->dwVnum, k->lMapIndex, k->x, k->y, k->lLife); m_map_pkObjectTable.insert(std::make_pair(k->dwID, k)); diff --git a/src/db/src/ClientManagerEventFlag.cpp b/src/db/src/ClientManagerEventFlag.cpp index 3f50203..1d6eb54 100644 --- a/src/db/src/ClientManagerEventFlag.cpp +++ b/src/db/src/ClientManagerEventFlag.cpp @@ -21,7 +21,7 @@ void CClientManager::LoadEventFlag() TPacketSetEventFlag p; strlcpy(p.szFlagName, row[0], sizeof(p.szFlagName)); str_to_number(p.lValue, row[1]); - sys_log(0, "EventFlag Load %s %d", p.szFlagName, p.lValue); + SPDLOG_DEBUG("EventFlag Load {} {}", p.szFlagName, p.lValue); m_map_lEventFlag.insert(std::make_pair(std::string(p.szFlagName), p.lValue)); ForwardPacket(HEADER_DG_SET_EVENT_FLAG, &p, sizeof(TPacketSetEventFlag)); } @@ -56,10 +56,10 @@ void CClientManager::SetEventFlag(TPacketSetEventFlag* p) //CDBManager::instance().ReturnQuery(szQuery, QID_QUEST_SAVE, 0, NULL); CDBManager::instance().AsyncQuery(szQuery); - sys_log(0, "HEADER_GD_SET_EVENT_FLAG : Changed CClientmanager::SetEventFlag(%s %d) ", p->szFlagName, p->lValue); + SPDLOG_DEBUG("HEADER_GD_SET_EVENT_FLAG : Changed CClientmanager::SetEventFlag({} {}) ", p->szFlagName, p->lValue); return; } - sys_log(0, "HEADER_GD_SET_EVENT_FLAG : No Changed CClientmanager::SetEventFlag(%s %d) ", p->szFlagName, p->lValue); + SPDLOG_DEBUG("HEADER_GD_SET_EVENT_FLAG : No Changed CClientmanager::SetEventFlag({} {}) ", p->szFlagName, p->lValue); } void CClientManager::SendEventFlagsOnSetup(CPeer* peer) diff --git a/src/db/src/ClientManagerGuild.cpp b/src/db/src/ClientManagerGuild.cpp index e65b6cb..b706c60 100644 --- a/src/db/src/ClientManagerGuild.cpp +++ b/src/db/src/ClientManagerGuild.cpp @@ -10,7 +10,7 @@ void CClientManager::GuildCreate(CPeer * peer, DWORD dwGuildID) { - sys_log(0, "GuildCreate %u", dwGuildID); + SPDLOG_DEBUG("GuildCreate {}", dwGuildID); ForwardPacket(HEADER_DG_GUILD_LOAD, &dwGuildID, sizeof(DWORD)); CGuildManager::instance().Load(dwGuildID); @@ -18,14 +18,14 @@ void CClientManager::GuildCreate(CPeer * peer, DWORD dwGuildID) void CClientManager::GuildChangeGrade(CPeer* peer, TPacketGuild* p) { - sys_log(0, "GuildChangeGrade %u %u", p->dwGuild, p->dwInfo); + SPDLOG_DEBUG("GuildChangeGrade {} {}", p->dwGuild, p->dwInfo); ForwardPacket(HEADER_DG_GUILD_CHANGE_GRADE, p, sizeof(TPacketGuild)); } void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p) { CGuildManager::instance().TouchGuild(p->dwGuild); - sys_log(0, "GuildAddMember %u %u", p->dwGuild, p->dwPID); + SPDLOG_DEBUG("GuildAddMember {} {}", p->dwGuild, p->dwPID); char szQuery[512]; @@ -42,7 +42,7 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p) if (pmsg->Get()->uiNumRows == 0) { - sys_err("Query failed when getting guild member data %s", pmsg->stQuery.c_str()); + SPDLOG_ERROR("Query failed when getting guild member data {}", pmsg->stQuery.c_str()); return; } @@ -67,7 +67,7 @@ void CClientManager::GuildAddMember(CPeer* peer, TPacketGDGuildAddMember * p) void CClientManager::GuildRemoveMember(CPeer* peer, TPacketGuild* p) { - sys_log(0, "GuildRemoveMember %u %u", p->dwGuild, p->dwInfo); + SPDLOG_DEBUG("GuildRemoveMember {} {}", p->dwGuild, p->dwInfo); char szQuery[512]; snprintf(szQuery, sizeof(szQuery), "DELETE FROM guild_member%s WHERE pid=%u and guild_id=%u", GetTablePostfix(), p->dwInfo, p->dwGuild); @@ -81,25 +81,25 @@ void CClientManager::GuildRemoveMember(CPeer* peer, TPacketGuild* p) void CClientManager::GuildSkillUpdate(CPeer* peer, TPacketGuildSkillUpdate* p) { - sys_log(0, "GuildSkillUpdate %d", p->amount); + SPDLOG_DEBUG("GuildSkillUpdate {}", p->amount); ForwardPacket(HEADER_DG_GUILD_SKILL_UPDATE, p, sizeof(TPacketGuildSkillUpdate)); } void CClientManager::GuildExpUpdate(CPeer* peer, TPacketGuildExpUpdate* p) { - sys_log(0, "GuildExpUpdate %d", p->amount); + SPDLOG_DEBUG("GuildExpUpdate {}", p->amount); ForwardPacket(HEADER_DG_GUILD_EXP_UPDATE, p, sizeof(TPacketGuildExpUpdate), 0, peer); } void CClientManager::GuildChangeMemberData(CPeer* peer, TPacketGuildChangeMemberData* p) { - sys_log(0, "GuildChangeMemberData %u %u %d %d", p->pid, p->offer, p->level, p->grade); + SPDLOG_DEBUG("GuildChangeMemberData {} {} {} {}", p->pid, p->offer, p->level, p->grade); ForwardPacket(HEADER_DG_GUILD_CHANGE_MEMBER_DATA, p, sizeof(TPacketGuildChangeMemberData), 0, peer); } void CClientManager::GuildDisband(CPeer* peer, TPacketGuild* p) { - sys_log(0, "GuildDisband %u", p->dwGuild); + SPDLOG_DEBUG("GuildDisband {}", p->dwGuild); char szQuery[512]; @@ -141,12 +141,12 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p) switch (p->bWar) { case GUILD_WAR_SEND_DECLARE: - sys_log(0, "GuildWar: GUILD_WAR_SEND_DECLARE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_SEND_DECLARE type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().AddDeclare(p->bType, p->dwGuildFrom, p->dwGuildTo); break; case GUILD_WAR_REFUSE: - sys_log(0, "GuildWar: GUILD_WAR_REFUSE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_REFUSE type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo); break; /* @@ -160,10 +160,10 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p) */ case GUILD_WAR_WAIT_START: - sys_log(0, "GuildWar: GUILD_WAR_WAIT_START type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_WAIT_START type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); case GUILD_WAR_RESERVE: // ±æµåÀü ¿¹¾à if (p->bWar != GUILD_WAR_WAIT_START) - sys_log(0, "GuildWar: GUILD_WAR_RESERVE type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_RESERVE type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo); if (!CGuildManager::instance().ReserveWar(p)) @@ -174,23 +174,23 @@ void CClientManager::GuildWar(CPeer* peer, TPacketGuildWar* p) break; case GUILD_WAR_ON_WAR: // ±æµåÀüÀ» ½ÃÀÛ ½ÃŲ´Ù. (ÇʵåÀüÀº ¹Ù·Î ½ÃÀÛ µÊ) - sys_log(0, "GuildWar: GUILD_WAR_ON_WAR type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_ON_WAR type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RemoveDeclare(p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().StartWar(p->bType, p->dwGuildFrom, p->dwGuildTo); break; case GUILD_WAR_OVER: // ±æµåÀü Á¤»ó Á¾·á - sys_log(0, "GuildWar: GUILD_WAR_OVER type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_OVER type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RecvWarOver(p->dwGuildFrom, p->dwGuildTo, p->bType, p->lWarPrice); break; case GUILD_WAR_END: // ±æµåÀü ºñÁ¤»ó Á¾·á - sys_log(0, "GuildWar: GUILD_WAR_END type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_END type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().RecvWarEnd(p->dwGuildFrom, p->dwGuildTo); return; // NOTE: RecvWarEnd¿¡¼­ ÆÐŶÀ» º¸³»¹Ç·Î µû·Î ºê·Îµåij½ºÆà ÇÏÁö ¾Ê´Â´Ù. case GUILD_WAR_CANCEL : - sys_log(0, "GuildWar: GUILD_WAR_CANCEL type(%s) guild(%d - %d)", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); + SPDLOG_DEBUG("GuildWar: GUILD_WAR_CANCEL type({}) guild({} - {})", __GetWarType(p->bType), p->dwGuildFrom, p->dwGuildTo); CGuildManager::instance().CancelWar(p->dwGuildFrom, p->dwGuildTo); break; } @@ -205,20 +205,20 @@ void CClientManager::GuildWarScore(CPeer* peer, TPacketGuildWarScore * p) void CClientManager::GuildChangeLadderPoint(TPacketGuildLadderPoint* p) { - sys_log(0, "GuildChangeLadderPoint Recv %u %d", p->dwGuild, p->lChange); + SPDLOG_DEBUG("GuildChangeLadderPoint Recv {} {}", p->dwGuild, p->lChange); CGuildManager::instance().ChangeLadderPoint(p->dwGuild, p->lChange); } void CClientManager::GuildUseSkill(TPacketGuildUseSkill* p) { - sys_log(0, "GuildUseSkill Recv %u %d", p->dwGuild, p->dwSkillVnum); + SPDLOG_DEBUG("GuildUseSkill Recv {} {}", p->dwGuild, p->dwSkillVnum); CGuildManager::instance().UseSkill(p->dwGuild, p->dwSkillVnum, p->dwCooltime); SendGuildSkillUsable(p->dwGuild, p->dwSkillVnum, false); } void CClientManager::SendGuildSkillUsable(DWORD guild_id, DWORD dwSkillVnum, bool bUsable) { - sys_log(0, "SendGuildSkillUsable Send %u %d %s", guild_id, dwSkillVnum, bUsable?"true":"false"); + SPDLOG_DEBUG("SendGuildSkillUsable Send {} {} {}", guild_id, dwSkillVnum, bUsable?"true":"false"); TPacketGuildSkillUsableChange p; diff --git a/src/db/src/ClientManagerLogin.cpp b/src/db/src/ClientManagerLogin.cpp index a27539f..280dc4e 100644 --- a/src/db/src/ClientManagerLogin.cpp +++ b/src/db/src/ClientManagerLogin.cpp @@ -11,7 +11,6 @@ extern std::string g_stLocale; extern bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab); extern int g_test_server; -extern int g_log; bool CClientManager::InsertLogonAccount(const char * c_pszLogin, DWORD dwHandle, const char * c_pszIP) { @@ -49,7 +48,7 @@ bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle) if (pkLD->GetConnectedPeerHandle() != dwHandle) { - sys_err("%s tried to logout in other peer handle %lu, current handle %lu", szLogin, dwHandle, pkLD->GetConnectedPeerHandle()); + SPDLOG_ERROR("{} tried to logout in other peer handle {}, current handle {}", szLogin, dwHandle, pkLD->GetConnectedPeerHandle()); return false; } @@ -87,7 +86,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG if (!pkLoginData) { - sys_log(0, "LOGIN_BY_KEY key not exist %s %lu", szLogin, p->dwLoginKey); + SPDLOG_DEBUG("LOGIN_BY_KEY key not exist {} {}", szLogin, p->dwLoginKey); pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle); return; } @@ -96,7 +95,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG if (FindLogonAccount(r.login)) { - sys_log(0, "LOGIN_BY_KEY already login %s %lu", r.login, p->dwLoginKey); + SPDLOG_DEBUG("LOGIN_BY_KEY already login {} {}", r.login, p->dwLoginKey); TPacketDGLoginAlready ptog; strlcpy(ptog.szLogin, szLogin, sizeof(ptog.szLogin)); pkPeer->EncodeHeader(HEADER_DG_LOGIN_ALREADY, dwHandle, sizeof(TPacketDGLoginAlready)); @@ -106,7 +105,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG if (strcasecmp(r.login, szLogin)) { - sys_log(0, "LOGIN_BY_KEY login differ %s %lu input %s", r.login, p->dwLoginKey, szLogin); + SPDLOG_DEBUG("LOGIN_BY_KEY login differ {} {} input {}", r.login, p->dwLoginKey, szLogin); pkPeer->EncodeReturn(HEADER_DG_LOGIN_NOT_EXIST, dwHandle); return; } @@ -115,7 +114,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG { const DWORD * pdwClientKey = pkLoginData->GetClientKey(); - sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu", + SPDLOG_DEBUG("LOGIN_BY_KEY client key differ {} {} {} {} {}, {} {} {} {}", r.login, p->adwClientKey[0], p->adwClientKey[1], p->adwClientKey[2], p->adwClientKey[3], pdwClientKey[0], pdwClientKey[1], pdwClientKey[2], pdwClientKey[3]); @@ -137,7 +136,7 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG info->pAccountTable = pkTab; strlcpy(info->ip, p->szIP, sizeof(info->ip)); - sys_log(0, "LOGIN_BY_KEY success %s %lu %s", r.login, p->dwLoginKey, info->ip); + SPDLOG_DEBUG("LOGIN_BY_KEY success {} {} {}", r.login, p->dwLoginKey, info->ip); char szQuery[QUERY_MAX_LEN]; snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id); CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info); @@ -164,11 +163,11 @@ void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg) snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id); std::unique_ptr pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER)); - sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id); + SPDLOG_DEBUG("RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:{}", account_id); if (pMsg->Get()->uiNumRows == 0) { - sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id); + SPDLOG_DEBUG("RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:{}", account_id); // PLAYER_INDEX_CREATE_BUG_FIX //snprintf(szQuery, sizeof(szQuery), "INSERT IGNORE INTO player_index%s (id) VALUES(%lu)", GetTablePostfix(), info->pAccountTable->id); @@ -332,14 +331,14 @@ void CreateAccountPlayerDataFromRes(MYSQL_RES * pRes, TAccountTable * pkTab) str_to_number(pkTab->players[j].bChangeName, row[col++]); } - sys_log(0, "%s %lu %lu hair %u", + SPDLOG_DEBUG("{} {} {} hair {}", pkTab->players[j].szName, pkTab->players[j].x, pkTab->players[j].y, pkTab->players[j].wHairPart); break; } } /* if (j == PLAYER_PER_ACCOUNT) - sys_err("cannot find player_id on this account (login: %s id %lu account %lu %lu %lu)", + SPDLOG_ERROR("cannot find player_id on this account (login: {} id {} account {} {} {})", pkTab->login, player_id, pkTab->players[0].dwID, pkTab->players[1].dwID, @@ -358,7 +357,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) // °èÁ¤ÀÌ ¾ø³×? if (msg->Get()->uiNumRows == 0) { - sys_log(0, "RESULT_LOGIN: no account"); + SPDLOG_DEBUG("RESULT_LOGIN: no account"); peer->EncodeHeader(HEADER_DG_LOGIN_NOT_EXIST, info->dwHandle, 0); delete info; return; @@ -368,7 +367,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) if (!info->pAccountTable) { - sys_log(0, "RESULT_LOGIN: no account : WRONG_PASSWD"); + SPDLOG_DEBUG("RESULT_LOGIN: no account : WRONG_PASSWD"); peer->EncodeReturn(HEADER_DG_LOGIN_WRONG_PASSWD, info->dwHandle); delete info; } @@ -407,7 +406,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) // ´Ù¸¥ ÄÁ³Ø¼ÇÀÌ ÀÌ¹Ì ·Î±×ÀÎ Çعö·È´Ù¸é.. ÀÌ¹Ì Á¢¼ÓÇß´Ù°í º¸³»¾ß ÇÑ´Ù. if (!InsertLogonAccount(info->pAccountTable->login, peer->GetHandle(), info->ip)) { - sys_log(0, "RESULT_LOGIN: already logon %s", info->pAccountTable->login); + SPDLOG_DEBUG("RESULT_LOGIN: already logon {}", info->pAccountTable->login); TPacketDGLoginAlready p; strlcpy(p.szLogin, info->pAccountTable->login, sizeof(p.szLogin)); @@ -417,7 +416,7 @@ void CClientManager::RESULT_LOGIN(CPeer * peer, SQLMsg * msg) } else { - sys_log(0, "RESULT_LOGIN: login success %s rows: %lu", info->pAccountTable->login, msg->Get()->uiNumRows); + SPDLOG_DEBUG("RESULT_LOGIN: login success {} rows: {}", info->pAccountTable->login, msg->Get()->uiNumRows); if (msg->Get()->uiNumRows > 0) CreateAccountPlayerDataFromRes(msg->Get()->pSQLResult, info->pAccountTable); @@ -456,23 +455,20 @@ void CClientManager::QUERY_LOGOUT(CPeer * peer, DWORD dwHandle,const char * data { if (pLoginData->GetAccountRef().players[n].dwID == 0) { - if (g_test_server) - sys_log(0, "LOGOUT %s %d", packet->login, pLoginData->GetAccountRef().players[n].dwID); + SPDLOG_TRACE("LOGOUT {} {}", packet->login, pLoginData->GetAccountRef().players[n].dwID); continue; } pid[n] = pLoginData->GetAccountRef().players[n].dwID; - if (g_log) - sys_log(0, "LOGOUT InsertLogoutPlayer %s %d", packet->login, pid[n]); + SPDLOG_TRACE("LOGOUT InsertLogoutPlayer {} {}", packet->login, pid[n]); InsertLogoutPlayer(pid[n]); } if (DeleteLogonAccount(packet->login, peer->GetHandle())) { - if (g_log) - sys_log(0, "LOGOUT %s ", packet->login); + SPDLOG_TRACE("LOGOUT {} ", packet->login); } } diff --git a/src/db/src/ClientManagerParty.cpp b/src/db/src/ClientManagerParty.cpp index 2e719a6..6065d80 100644 --- a/src/db/src/ClientManagerParty.cpp +++ b/src/db/src/ClientManagerParty.cpp @@ -13,11 +13,11 @@ void CClientManager::QUERY_PARTY_CREATE(CPeer* peer, TPacketPartyCreate* p) { pm.insert(make_pair(p->dwLeaderPID, TPartyMember())); ForwardPacket(HEADER_DG_PARTY_CREATE, p, sizeof(TPacketPartyCreate), peer->GetChannel(), peer); - sys_log(0, "PARTY Create [%lu]", p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Create [{}]", p->dwLeaderPID); } else { - sys_err("PARTY Create - Already exists [%lu]", p->dwLeaderPID); + SPDLOG_ERROR("PARTY Create - Already exists [{}]", p->dwLeaderPID); } } @@ -28,13 +28,13 @@ void CClientManager::QUERY_PARTY_DELETE(CPeer* peer, TPacketPartyDelete* p) if (it == pm.end()) { - sys_err("PARTY Delete - Non exists [%lu]", p->dwLeaderPID); + SPDLOG_ERROR("PARTY Delete - Non exists [{}]", p->dwLeaderPID); return; } pm.erase(it); ForwardPacket(HEADER_DG_PARTY_DELETE, p, sizeof(TPacketPartyDelete), peer->GetChannel(), peer); - sys_log(0, "PARTY Delete [%lu]", p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Delete [{}]", p->dwLeaderPID); } void CClientManager::QUERY_PARTY_ADD(CPeer* peer, TPacketPartyAdd* p) @@ -44,7 +44,7 @@ void CClientManager::QUERY_PARTY_ADD(CPeer* peer, TPacketPartyAdd* p) if (it == pm.end()) { - sys_err("PARTY Add - Non exists [%lu]", p->dwLeaderPID); + SPDLOG_ERROR("PARTY Add - Non exists [{}]", p->dwLeaderPID); return; } @@ -52,10 +52,10 @@ void CClientManager::QUERY_PARTY_ADD(CPeer* peer, TPacketPartyAdd* p) { it->second.insert(std::make_pair(p->dwPID, TPartyInfo())); ForwardPacket(HEADER_DG_PARTY_ADD, p, sizeof(TPacketPartyAdd), peer->GetChannel(), peer); - sys_log(0, "PARTY Add [%lu] to [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Add [{}] to [{}]", p->dwPID, p->dwLeaderPID); } else - sys_err("PARTY Add - Already [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY Add - Already [{}] in party [{}]", p->dwPID, p->dwLeaderPID); } void CClientManager::QUERY_PARTY_REMOVE(CPeer* peer, TPacketPartyRemove* p) @@ -65,7 +65,7 @@ void CClientManager::QUERY_PARTY_REMOVE(CPeer* peer, TPacketPartyRemove* p) if (it == pm.end()) { - sys_err("PARTY Remove - Non exists [%lu] cannot remove [%lu]",p->dwLeaderPID, p->dwPID); + SPDLOG_ERROR("PARTY Remove - Non exists [{}] cannot remove [{}]",p->dwLeaderPID, p->dwPID); return; } @@ -75,10 +75,10 @@ void CClientManager::QUERY_PARTY_REMOVE(CPeer* peer, TPacketPartyRemove* p) { it->second.erase(pit); ForwardPacket(HEADER_DG_PARTY_REMOVE, p, sizeof(TPacketPartyRemove), peer->GetChannel(), peer); - sys_log(0, "PARTY Remove [%lu] to [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_DEBUG("PARTY Remove [{}] to [{}]", p->dwPID, p->dwLeaderPID); } else - sys_err("PARTY Remove - Cannot find [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY Remove - Cannot find [{}] in party [{}]", p->dwPID, p->dwLeaderPID); } void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChange* p) @@ -88,7 +88,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan if (it == pm.end()) { - sys_err("PARTY StateChange - Non exists [%lu] cannot state change [%lu]",p->dwLeaderPID, p->dwPID); + SPDLOG_ERROR("PARTY StateChange - Non exists [{}] cannot state change [{}]",p->dwLeaderPID, p->dwPID); return; } @@ -96,7 +96,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan if (pit == it->second.end()) { - sys_err("PARTY StateChange - Cannot find [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY StateChange - Cannot find [{}] in party [{}]", p->dwPID, p->dwLeaderPID); return; } @@ -106,7 +106,7 @@ void CClientManager::QUERY_PARTY_STATE_CHANGE(CPeer* peer, TPacketPartyStateChan pit->second.bRole = 0; ForwardPacket(HEADER_DG_PARTY_STATE_CHANGE, p, sizeof(TPacketPartyStateChange), peer->GetChannel(), peer); - sys_log(0, "PARTY StateChange [%lu] at [%lu] from %d %d",p->dwPID, p->dwLeaderPID, p->bRole, p->bFlag); + SPDLOG_DEBUG("PARTY StateChange [{}] at [{}] from {} {}",p->dwPID, p->dwLeaderPID, p->bRole, p->bFlag); } void CClientManager::QUERY_PARTY_SET_MEMBER_LEVEL(CPeer* peer, TPacketPartySetMemberLevel* p) @@ -116,7 +116,7 @@ void CClientManager::QUERY_PARTY_SET_MEMBER_LEVEL(CPeer* peer, TPacketPartySetMe if (it == pm.end()) { - sys_err("PARTY SetMemberLevel - Non exists [%lu] cannot level change [%lu]",p->dwLeaderPID, p->dwPID); + SPDLOG_ERROR("PARTY SetMemberLevel - Non exists [{}] cannot level change [{}]",p->dwLeaderPID, p->dwPID); return; } @@ -124,12 +124,12 @@ void CClientManager::QUERY_PARTY_SET_MEMBER_LEVEL(CPeer* peer, TPacketPartySetMe if (pit == it->second.end()) { - sys_err("PARTY SetMemberLevel - Cannot find [%lu] in party [%lu]", p->dwPID, p->dwLeaderPID); + SPDLOG_ERROR("PARTY SetMemberLevel - Cannot find [{}] in party [{}]", p->dwPID, p->dwLeaderPID); return; } pit->second.bLevel = p->bLevel; ForwardPacket(HEADER_DG_PARTY_SET_MEMBER_LEVEL, p, sizeof(TPacketPartySetMemberLevel), peer->GetChannel()); - sys_log(0, "PARTY SetMemberLevel pid [%lu] level %d",p->dwPID, p->bLevel); + SPDLOG_DEBUG("PARTY SetMemberLevel pid [{}] level {}",p->dwPID, p->bLevel); } diff --git a/src/db/src/ClientManagerPlayer.cpp b/src/db/src/ClientManagerPlayer.cpp index fc2af0c..944da6e 100644 --- a/src/db/src/ClientManagerPlayer.cpp +++ b/src/db/src/ClientManagerPlayer.cpp @@ -13,7 +13,6 @@ extern bool g_bHotBackup; extern std::string g_stLocale; extern int g_test_server; -extern int g_log; // // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -236,7 +235,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad if (!pkLD || pkLD->IsPlay()) { - sys_log(0, "PLAYER_LOAD_ERROR: LoginData %p IsPlay %d", pkLD, pkLD ? pkLD->IsPlay() : 0); + SPDLOG_DEBUG("PLAYER_LOAD_ERROR: LoginData {} IsPlay {}", (void*) pkLD, pkLD ? pkLD->IsPlay() : 0); peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_FAILED, dwHandle, 0); return; } @@ -265,7 +264,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad TItemCacheSet * pSet = GetItemCacheSet(pTab->id); - sys_log(0, "[PLAYER_LOAD] ID %s pid %d gold %d ", pTab->name, pTab->id, pTab->gold); + SPDLOG_DEBUG("[PLAYER_LOAD] ID {} pid {} gold {} ", pTab->name, pTab->id, pTab->gold); //-------------------------------------------- // ¾ÆÀÌÅÛ & AFFECT & QUEST ·Îµù : @@ -293,8 +292,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad memcpy(&s_items[dwCount++], p, sizeof(TPlayerItem)); } - if (g_test_server) - sys_log(0, "ITEM_CACHE: HIT! %s count: %u", pTab->name, dwCount); + SPDLOG_TRACE("ITEM_CACHE: HIT! {} count: {}", pTab->name, dwCount); peer->EncodeHeader(HEADER_DG_ITEM_LOAD, dwHandle, sizeof(DWORD) + sizeof(TPlayerItem) * dwCount); peer->EncodeDWORD(dwCount); @@ -354,7 +352,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad //---------------------------------- else { - sys_log(0, "[PLAYER_LOAD] Load from PlayerDB pid[%d]", packet->player_id); + SPDLOG_DEBUG("[PLAYER_LOAD] Load from PlayerDB pid[{}]", packet->player_id); char queryStr[QUERY_MAX_LEN]; @@ -554,26 +552,26 @@ void CClientManager::RESULT_COMPOSITE_PLAYER(CPeer * peer, SQLMsg * pMsg, DWORD MYSQL_RES * pSQLResult = pMsg->Get()->pSQLResult; if (!pSQLResult) { - sys_err("null MYSQL_RES QID %u", dwQID); + SPDLOG_ERROR("null MYSQL_RES QID {}", dwQID); return; } switch (dwQID) { case QID_PLAYER: - sys_log(0, "QID_PLAYER %u %u", info->dwHandle, info->player_id); + SPDLOG_DEBUG("QID_PLAYER {} {}", info->dwHandle, info->player_id); RESULT_PLAYER_LOAD(peer, pSQLResult, info.get()); break; case QID_ITEM: - sys_log(0, "QID_ITEM %u", info->dwHandle); + SPDLOG_DEBUG("QID_ITEM {}", info->dwHandle); RESULT_ITEM_LOAD(peer, pSQLResult, info->dwHandle, info->player_id); break; case QID_QUEST: { - sys_log(0, "QID_QUEST %u", info->dwHandle); + SPDLOG_DEBUG("QID_QUEST {}", info->dwHandle); RESULT_QUEST_LOAD(peer, pSQLResult, info->dwHandle, info->player_id); //aid¾ò±â ClientHandleInfo* temp1 = info.get(); @@ -586,42 +584,42 @@ void CClientManager::RESULT_COMPOSITE_PLAYER(CPeer * peer, SQLMsg * pMsg, DWORD break; if( pLoginData1 == NULL ) break; - sys_log(0,"info of pLoginData1 before call ItemAwardfunction %d",pLoginData1); + SPDLOG_DEBUG("info of pLoginData1 before call ItemAwardfunction {}", (void*) pLoginData1); ItemAward(peer,pLoginData1->GetAccountRef().login); } break; case QID_AFFECT: - sys_log(0, "QID_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_AFFECT {}", info->dwHandle); RESULT_AFFECT_LOAD(peer, pSQLResult, info->dwHandle); break; /* case QID_PLAYER_ITEM_QUEST_AFFECT: - sys_log(0, "QID_PLAYER_ITEM_QUEST_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_PLAYER_ITEM_QUEST_AFFECT {}", info->dwHandle); RESULT_PLAYER_LOAD(peer, pSQLResult, info->dwHandle); if (!pMsg->Next()) { - sys_err("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: ITEM FAILED"); + SPDLOG_ERROR("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: ITEM FAILED"); return; } case QID_ITEM_QUEST_AFFECT: - sys_log(0, "QID_ITEM_QUEST_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_ITEM_QUEST_AFFECT {}", info->dwHandle); RESULT_ITEM_LOAD(peer, pSQLResult, info->dwHandle, info->player_id); if (!pMsg->Next()) { - sys_err("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: QUEST FAILED"); + SPDLOG_ERROR("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: QUEST FAILED"); return; } case QID_QUEST_AFFECT: - sys_log(0, "QID_QUEST_AFFECT %u", info->dwHandle); + SPDLOG_DEBUG("QID_QUEST_AFFECT {}", info->dwHandle); RESULT_QUEST_LOAD(peer, pSQLResult, info->dwHandle); if (!pMsg->Next()) - sys_err("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: AFFECT FAILED"); + SPDLOG_ERROR("RESULT_COMPOSITE_PLAYER: QID_PLAYER_ITEM_QUEST_AFFECT: AFFECT FAILED"); else RESULT_AFFECT_LOAD(peer, pSQLResult, info->dwHandle); @@ -645,7 +643,7 @@ void CClientManager::RESULT_PLAYER_LOAD(CPeer * peer, MYSQL_RES * pRes, ClientHa if (!pkLD || pkLD->IsPlay()) { - sys_log(0, "PLAYER_LOAD_ERROR: LoginData %p IsPlay %d", pkLD, pkLD ? pkLD->IsPlay() : 0); + SPDLOG_DEBUG("PLAYER_LOAD_ERROR: LoginData {} IsPlay {}", (void*) pkLD, pkLD ? pkLD->IsPlay() : 0); peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_FAILED, pkInfo->dwHandle, 0); return; } @@ -683,7 +681,7 @@ void CClientManager::RESULT_ITEM_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwHa CreateItemCacheSet(dwPID); // ITEM_LOAD_LOG_ATTACH_PID - sys_log(0, "ITEM_LOAD: count %u pid %u", dwCount, dwPID); + SPDLOG_DEBUG("ITEM_LOAD: count {} pid {}", dwCount, dwPID); // END_OF_ITEM_LOAD_LOG_ATTACH_PID if (dwCount) @@ -725,7 +723,7 @@ void CClientManager::RESULT_AFFECT_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dw str_to_number(r.lSPCost, row[6]); } - sys_log(0, "AFFECT_LOAD: count %d PID %u", s_elements.size(), dwPID); + SPDLOG_DEBUG("AFFECT_LOAD: count {} PID {}", s_elements.size(), dwPID); DWORD dwCount = s_elements.size(); @@ -764,7 +762,7 @@ void CClientManager::RESULT_QUEST_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwH str_to_number(r.lValue, row[3]); } - sys_log(0, "QUEST_LOAD: count %d PID %u", s_table.size(), s_table[0].dwPID); + SPDLOG_DEBUG("QUEST_LOAD: count {} PID {}", s_table.size(), s_table[0].dwPID); DWORD dwCount = s_table.size(); @@ -778,8 +776,7 @@ void CClientManager::RESULT_QUEST_LOAD(CPeer * peer, MYSQL_RES * pRes, DWORD dwH */ void CClientManager::QUERY_PLAYER_SAVE(CPeer * peer, DWORD dwHandle, TPlayerTable * pkTab) { - if (g_test_server) - sys_log(0, "PLAYER_SAVE: %s", pkTab->name); + SPDLOG_TRACE("PLAYER_SAVE: {}", pkTab->name); PutPlayerCache(pkTab); } @@ -829,7 +826,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC if (row[0] && dwPID > 0) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); - sys_log(0, "ALREADY EXIST AccountChrIdx %d ID %d", packet->account_index, dwPID); + SPDLOG_DEBUG("ALREADY EXIST AccountChrIdx {} ID {}", packet->account_index, dwPID); return; } } @@ -861,7 +858,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC if (*row[0] != '0') { - sys_log(0, "ALREADY EXIST name %s, row[0] %s query %s", packet->player_table.name, row[0], queryStr); + SPDLOG_DEBUG("ALREADY EXIST name {}, row[0] {} query {}", packet->player_table.name, row[0], queryStr); peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); return; } @@ -886,7 +883,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC packet->player_table.job, packet->player_table.voice, packet->player_table.dir, packet->player_table.x, packet->player_table.y, packet->player_table.z, packet->player_table.hp, packet->player_table.sp, packet->player_table.sRandomHP, packet->player_table.sRandomSP, packet->player_table.stat_point, packet->player_table.stamina, packet->player_table.part_base, packet->player_table.part_base, packet->player_table.gold); - sys_log(0, "PlayerCreate accountid %d name %s level %d gold %d, st %d ht %d job %d", + SPDLOG_DEBUG("PlayerCreate accountid {} name {} level {} gold {}, st {} ht {} job {}", packet->account_id, packet->player_table.name, packet->player_table.level, @@ -899,20 +896,18 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC CDBManager::instance().EscapeString(text, packet->player_table.skills, sizeof(packet->player_table.skills)); queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s', ", text); - if (g_test_server) - sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text); + SPDLOG_TRACE("Create_Player queryLen[{}] TEXT[{}]", queryLen, text); CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot)); queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text); std::unique_ptr pMsg2(CDBManager::instance().DirectQuery(queryStr)); - if (g_test_server) - sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text); + SPDLOG_TRACE("Create_Player queryLen[{}] TEXT[{}]", queryLen, text); if (pMsg2->Get()->uiAffectedRows <= 0) { peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0); - sys_log(0, "ALREADY EXIST3 query: %s AffectedRows %lu", queryStr, pMsg2->Get()->uiAffectedRows); + SPDLOG_DEBUG("ALREADY EXIST3 query: {} AffectedRows {}", queryStr, pMsg2->Get()->uiAffectedRows); return; } @@ -924,7 +919,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC if (pMsg3->Get()->uiAffectedRows <= 0) { - sys_err("QUERY_ERROR: %s", queryStr); + SPDLOG_ERROR("QUERY_ERROR: {}", queryStr); snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), player_id); CDBManager::instance().DirectQuery(queryStr); @@ -954,7 +949,7 @@ void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerC peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_SUCCESS, dwHandle, sizeof(TPacketDGCreateSuccess)); peer->Encode(&pack, sizeof(TPacketDGCreateSuccess)); - sys_log(0, "7 name %s job %d", pack.player.szName, pack.player.byJob); + SPDLOG_DEBUG("7 name {} job {}", pack.player.szName, pack.player.byJob); s_createTimeByAccountID[packet->account_id] = time(0); } @@ -985,7 +980,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD { if (strlen(r.social_id) < 7 || strncmp(packet->private_code, r.social_id + strlen(r.social_id) - 7, 7)) { - sys_log(0, "PLAYER_DELETE FAILED len(%d)", strlen(r.social_id)); + SPDLOG_DEBUG("PLAYER_DELETE FAILED len({})", strlen(r.social_id)); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1); peer->EncodeBYTE(packet->account_index); return; @@ -998,7 +993,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD if (pTab->level >= m_iPlayerDeleteLevelLimit) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u >= DELETE LIMIT %d", pTab->level, m_iPlayerDeleteLevelLimit); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} >= DELETE LIMIT {}", pTab->level, m_iPlayerDeleteLevelLimit); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1); peer->EncodeBYTE(packet->account_index); return; @@ -1006,7 +1001,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD if (pTab->level < m_iPlayerDeleteLevelLimitLower) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u < DELETE LIMIT %d", pTab->level, m_iPlayerDeleteLevelLimitLower); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} < DELETE LIMIT {}", pTab->level, m_iPlayerDeleteLevelLimitLower); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, dwHandle, 1); peer->EncodeBYTE(packet->account_index); return; @@ -1022,7 +1017,7 @@ void CClientManager::__QUERY_PLAYER_DELETE(CPeer* peer, DWORD dwHandle, TPlayerD ClientHandleInfo * pi = new ClientHandleInfo(dwHandle, packet->player_id); pi->account_index = packet->account_index; - sys_log(0, "PLAYER_DELETE TRY: %s %d pid%d", packet->login, packet->player_id, packet->account_index + 1); + SPDLOG_DEBUG("PLAYER_DELETE TRY: {} {} pid{}", packet->login, packet->player_id, packet->account_index + 1); CDBManager::instance().ReturnQuery(szQuery, QID_PLAYER_DELETE, peer->GetHandle(), pi); } @@ -1049,7 +1044,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (deletedLevelLimit >= m_iPlayerDeleteLevelLimit && !IsChinaEventServer()) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u >= DELETE LIMIT %d", deletedLevelLimit, m_iPlayerDeleteLevelLimit); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} >= DELETE LIMIT {}", deletedLevelLimit, m_iPlayerDeleteLevelLimit); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); return; @@ -1057,7 +1052,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (deletedLevelLimit < m_iPlayerDeleteLevelLimitLower) { - sys_log(0, "PLAYER_DELETE FAILED LEVEL %u < DELETE LIMIT %d", deletedLevelLimit, m_iPlayerDeleteLevelLimitLower); + SPDLOG_DEBUG("PLAYER_DELETE FAILED LEVEL {} < DELETE LIMIT {}", deletedLevelLimit, m_iPlayerDeleteLevelLimitLower); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); return; @@ -1071,7 +1066,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (pIns->Get()->uiAffectedRows == 0 || pIns->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "PLAYER_DELETE FAILED %u CANNOT INSERT TO player%s_deleted", dwPID, GetTablePostfix()); + SPDLOG_DEBUG("PLAYER_DELETE FAILED {} CANNOT INSERT TO player{}_deleted", dwPID, GetTablePostfix()); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); @@ -1079,7 +1074,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) } // »èÁ¦ ¼º°ø - sys_log(0, "PLAYER_DELETE SUCCESS %u", dwPID); + SPDLOG_DEBUG("PLAYER_DELETE SUCCESS {}", dwPID); char account_index_string[16]; @@ -1123,7 +1118,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) if (pMsg->Get()->uiAffectedRows == 0 || pMsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "PLAYER_DELETE FAIL WHEN UPDATE account table"); + SPDLOG_DEBUG("PLAYER_DELETE FAIL WHEN UPDATE account table"); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); return; @@ -1158,7 +1153,7 @@ void CClientManager::__RESULT_PLAYER_DELETE(CPeer *peer, SQLMsg* msg) else { // »èÁ¦ ½ÇÆÐ - sys_log(0, "PLAYER_DELETE FAIL NO ROW"); + SPDLOG_DEBUG("PLAYER_DELETE FAIL NO ROW"); peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1); peer->EncodeBYTE(pi->account_index); } @@ -1217,7 +1212,7 @@ void CClientManager::QUERY_HIGHSCORE_REGISTER(CPeer* peer, TPacketGDHighscore * char szQuery[128]; snprintf(szQuery, sizeof(szQuery), "SELECT value FROM highscore%s WHERE board='%s' AND pid = %u", GetTablePostfix(), data->szBoard, data->dwPID); - sys_log(0, "HEADER_GD_HIGHSCORE_REGISTER: PID %u", data->dwPID); + SPDLOG_DEBUG("HEADER_GD_HIGHSCORE_REGISTER: PID {}", data->dwPID); ClientHandleInfo * pi = new ClientHandleInfo(0); strlcpy(pi->login, data->szBoard, sizeof(pi->login)); @@ -1289,8 +1284,7 @@ void CClientManager::InsertLogoutPlayer(DWORD pid) if (it != m_map_logout.end()) { // Á¸ÀçÇÒ°æ¿ì ½Ã°£¸¸ °»½Å - if (g_log) - sys_log(0, "LOGOUT: Update player time pid(%d)", pid); + SPDLOG_TRACE("LOGOUT: Update player time pid({})", pid); it->second->time = time(0); return; @@ -1301,8 +1295,7 @@ void CClientManager::InsertLogoutPlayer(DWORD pid) pLogout->time = time(0); m_map_logout.insert(std::make_pair(pid, pLogout)); - if (g_log) - sys_log(0, "LOGOUT: Insert player pid(%d)", pid); + SPDLOG_TRACE("LOGOUT: Insert player pid({})", pid); } void CClientManager::DeleteLogoutPlayer(DWORD pid) diff --git a/src/db/src/Config.cpp b/src/db/src/Config.cpp index d35633b..216f122 100644 --- a/src/db/src/Config.cpp +++ b/src/db/src/Config.cpp @@ -171,7 +171,7 @@ bool CConfig::GetParam(const char*key, int index, DWORD *Param) str_to_number(*Param, szParam[index]); - sys_log(0, "GetParam %d", *Param); + SPDLOG_DEBUG("GetParam {}", *Param); return true; } const char * CConfig::Get(const char* key) diff --git a/src/db/src/DBManager.cpp b/src/db/src/DBManager.cpp index bc8c402..663021a 100644 --- a/src/db/src/DBManager.cpp +++ b/src/db/src/DBManager.cpp @@ -137,7 +137,7 @@ extern int g_query_count[2]; void CDBManager::ReturnQuery(const char * c_pszQuery, int iType, IDENT dwIdent, void * udata, int iSlot) { assert(iSlot < SQL_MAX_NUM); - //sys_log(0, "ReturnQuery %s", c_pszQuery); + //SPDLOG_DEBUG("ReturnQuery {}", c_pszQuery); CQueryInfo * p = new CQueryInfo; p->iType = iType; diff --git a/src/db/src/GuildManager.cpp b/src/db/src/GuildManager.cpp index f3cd6d4..75c08e1 100644 --- a/src/db/src/GuildManager.cpp +++ b/src/db/src/GuildManager.cpp @@ -145,8 +145,8 @@ void CGuildManager::ParseResult(SQLResult * pRes) str_to_number(r_info.gold, row[6]); str_to_number(r_info.level, row[7]); - sys_log(0, - "GuildWar: %-24s ladder %-5d win %-3d draw %-3d loss %-3d", + SPDLOG_DEBUG( + "GuildWar: {:24} ladder {:<5} win {:<3} draw {:<3} loss {:<3}", r_info.szName, r_info.ladder_point, r_info.win, @@ -170,17 +170,17 @@ void CGuildManager::Initialize() *str = '\0'; if (!polyPower.Analyze(str)) - sys_err("cannot set power poly: %s", str); + SPDLOG_ERROR("cannot set power poly: {}", str); else - sys_log(0, "POWER_POLY: %s", str); + SPDLOG_DEBUG("POWER_POLY: {}", str); if (!CConfig::instance().GetValue("POLY_HANDICAP", str, sizeof(str))) *str = '\0'; if (!polyHandicap.Analyze(str)) - sys_err("cannot set handicap poly: %s", str); + SPDLOG_ERROR("cannot set handicap poly: {}", str); else - sys_log(0, "HANDICAP_POLY: %s", str); + SPDLOG_DEBUG("HANDICAP_POLY: {}", str); QueryRanking(); } @@ -234,7 +234,7 @@ void CGuildManager::ResultRanking(MYSQL_RES * pRes) if (iLadderPoint != iLastLadderPoint) ++iRank; - sys_log(0, "GUILD_RANK: %-24s %2d %d", row[1], iRank, iLadderPoint); + SPDLOG_DEBUG("GUILD_RANK: {:24} {:2} {}", row[1], iRank, iLadderPoint); map_kLadderPointRankingByGID.insert(std::make_pair(dwGID, iRank)); } @@ -250,7 +250,7 @@ void CGuildManager::Update() { // UNKNOWN_GUILD_MANAGE_UPDATE_LOG /* - sys_log(0, "GuildManager::Update size %d now %d top %d, %s(%u) vs %s(%u)", + SPDLOG_DEBUG("GuildManager::Update size {} now {} top {}, {}({}) vs {}({})", m_WarMap.size(), now, m_pqOnWar.top().first, @@ -307,7 +307,7 @@ void CGuildManager::Update() p.dwGuildTo = ws.GID[1]; CClientManager::instance().ForwardPacket(HEADER_DG_GUILD_WAR, &p, sizeof(p)); - sys_log(0, "GuildWar: GUILD sending start of wait start war %d %d", ws.GID[0], ws.GID[1]); + SPDLOG_DEBUG("GuildWar: GUILD sending start of wait start war {} {}", ws.GID[0], ws.GID[1]); } } @@ -402,7 +402,7 @@ bool CGuildManager::IsHalfWinLadderPoint(DWORD dwGuildWinner, DWORD dwGuildLoser void CGuildManager::ProcessDraw(DWORD dwGuildID1, DWORD dwGuildID2) { - sys_log(0, "GuildWar: \tThe war between %d and %d is ended in draw", dwGuildID1, dwGuildID2); + SPDLOG_DEBUG("GuildWar: \tThe war between {} and {} is ended in draw", dwGuildID1, dwGuildID2); GuildWarDraw(dwGuildID1); GuildWarDraw(dwGuildID2); @@ -416,7 +416,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser) { GuildWarWin(dwGuildWinner); GuildWarLose(dwGuildLoser); - sys_log(0, "GuildWar: \tWinner : %d Loser : %d", dwGuildWinner, dwGuildLoser); + SPDLOG_DEBUG("GuildWar: \tWinner : {} Loser : {}", dwGuildWinner, dwGuildLoser); int iPoint = GetLadderPoint(dwGuildLoser); int gain = (int)(iPoint * 0.05); @@ -425,7 +425,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser) if (IsHalfWinLadderPoint(dwGuildWinner, dwGuildLoser)) gain /= 2; - sys_log(0, "GuildWar: \tgain : %d loss : %d", gain, loss); + SPDLOG_DEBUG("GuildWar: \tgain : {} loss : {}", gain, loss); ChangeLadderPoint(dwGuildWinner, gain); ChangeLadderPoint(dwGuildLoser, -loss); @@ -435,7 +435,7 @@ void CGuildManager::ProcessWinLose(DWORD dwGuildWinner, DWORD dwGuildLoser) void CGuildManager::RemoveWar(DWORD GID1, DWORD GID2) { - sys_log(0, "GuildWar: RemoveWar(%d, %d)", GID1, GID2); + SPDLOG_DEBUG("GuildWar: RemoveWar({}, {})", GID1, GID2); if (GID1 > GID2) std::swap(GID2, GID1); @@ -469,13 +469,13 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw) if (GID1 > GID2) std::swap(GID2, GID1); - sys_log(0, "GuildWar: WarEnd %d %d", GID1, GID2); + SPDLOG_DEBUG("GuildWar: WarEnd {} {}", GID1, GID2); itertype(m_WarMap[GID1]) itWarMap = m_WarMap[GID1].find(GID2); if (itWarMap == m_WarMap[GID1].end()) { - sys_err("GuildWar: war not exist or already ended. [1]"); + SPDLOG_ERROR("GuildWar: war not exist or already ended. [1]"); return; } @@ -484,7 +484,7 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw) if (!pData || pData->bEnd) { - sys_err("GuildWar: war not exist or already ended. [2]"); + SPDLOG_ERROR("GuildWar: war not exist or already ended. [2]"); return; } @@ -527,7 +527,7 @@ void CGuildManager::WarEnd(DWORD GID1, DWORD GID2, bool bForceDraw) // void CGuildManager::RecvWarOver(DWORD dwGuildWinner, DWORD dwGuildLoser, bool bDraw, int lWarPrice) { - sys_log(0, "GuildWar: RecvWarOver : winner %u vs %u draw? %d war_price %d", dwGuildWinner, dwGuildLoser, bDraw ? 1 : 0, lWarPrice); + SPDLOG_DEBUG("GuildWar: RecvWarOver : winner {} vs {} draw? {} war_price {}", dwGuildWinner, dwGuildLoser, bDraw ? 1 : 0, lWarPrice); DWORD GID1 = dwGuildWinner; DWORD GID2 = dwGuildLoser; @@ -570,13 +570,13 @@ void CGuildManager::RecvWarOver(DWORD dwGuildWinner, DWORD dwGuildLoser, bool bD void CGuildManager::RecvWarEnd(DWORD GID1, DWORD GID2) { - sys_log(0, "GuildWar: RecvWarEnded : %u vs %u", GID1, GID2); + SPDLOG_DEBUG("GuildWar: RecvWarEnded : {} vs {}", GID1, GID2); WarEnd(GID1, GID2, true); // ¹«Á¶°Ç ºñÁ¤»ó Á¾·á ½ÃÄÑ¾ß ÇÑ´Ù. } void CGuildManager::StartWar(BYTE bType, DWORD GID1, DWORD GID2, CGuildWarReserve * pkReserve) { - sys_log(0, "GuildWar: StartWar(%d,%d,%d)", bType, GID1, GID2); + SPDLOG_DEBUG("GuildWar: StartWar({},{},{})", bType, GID1, GID2); if (GID1 > GID2) std::swap(GID1, GID2); @@ -610,7 +610,7 @@ void CGuildManager::UpdateScore(DWORD dwGainGID, DWORD dwOppGID, int iScoreDelta if (!p || p->bEnd) { - sys_err("GuildWar: war not exist or already ended."); + SPDLOG_ERROR("GuildWar: war not exist or already ended."); return; } @@ -634,7 +634,7 @@ void CGuildManager::UpdateScore(DWORD dwGainGID, DWORD dwOppGID, int iScoreDelta iNewBetScore = p->iBetScore[1]; } - sys_log(0, "GuildWar: SendGuildWarScore guild %u wartype %u score_delta %d betscore_delta %d result %u, %u", + SPDLOG_DEBUG("GuildWar: SendGuildWarScore guild {} wartype {} score_delta {} betscore_delta {} result {}, {}", dwGainGID, p->bType, iScoreDelta, iBetScoreDelta, iNewScore, iNewBetScore); CClientManager::instance().for_each_peer(FSendGuildWarScore(dwGainGID, dwOppGID, iNewScore, iNewBetScore)); @@ -648,7 +648,7 @@ void CGuildManager::AddDeclare(BYTE bType, DWORD guild_from, DWORD guild_to) if (m_DeclareMap.find(di) == m_DeclareMap.end()) m_DeclareMap.insert(di); - sys_log(0, "GuildWar: AddDeclare(Type:%d,from:%d,to:%d)", bType, guild_from, guild_to); + SPDLOG_DEBUG("GuildWar: AddDeclare(Type:{},from:{},to:{})", bType, guild_from, guild_to); } void CGuildManager::RemoveDeclare(DWORD guild_from, DWORD guild_to) @@ -663,7 +663,7 @@ void CGuildManager::RemoveDeclare(DWORD guild_from, DWORD guild_to) if (it != m_DeclareMap.end()) m_DeclareMap.erase(it); - sys_log(0, "GuildWar: RemoveDeclare(from:%d,to:%d)", guild_from, guild_to); + SPDLOG_DEBUG("GuildWar: RemoveDeclare(from:{},to:{})", guild_from, guild_to); } bool CGuildManager::TakeBetPrice(DWORD dwGuildTo, DWORD dwGuildFrom, int lWarPrice) @@ -673,14 +673,14 @@ bool CGuildManager::TakeBetPrice(DWORD dwGuildTo, DWORD dwGuildFrom, int lWarPri if (it_from == m_map_kGuild.end() || it_to == m_map_kGuild.end()) { - sys_log(0, "TakeBetPrice: guild not exist %u %u", + SPDLOG_DEBUG("TakeBetPrice: guild not exist {} {}", dwGuildFrom, dwGuildTo); return false; } if (it_from->second.gold < lWarPrice || it_to->second.gold < lWarPrice) { - sys_log(0, "TakeBetPrice: not enough gold %u %d to %u %d", + SPDLOG_DEBUG("TakeBetPrice: not enough gold {} {} to {} {}", dwGuildFrom, it_from->second.gold, dwGuildTo, it_to->second.gold); return false; } @@ -704,8 +704,8 @@ bool CGuildManager::WaitStart(TPacketGuildWar * p) TGuildWaitStartInfo info(p->bType, p->dwGuildFrom, p->dwGuildTo, p->lWarPrice, p->lInitialScore, NULL); m_pqWaitStart.push(std::make_pair(dwCurTime + GetGuildWarWaitStartDuration(), info)); - sys_log(0, - "GuildWar: WaitStart g1 %d g2 %d price %d start at %u", + SPDLOG_DEBUG( + "GuildWar: WaitStart g1 {} g2 {} price {} start at {}", p->dwGuildFrom, p->dwGuildTo, p->lWarPrice, @@ -742,8 +742,8 @@ void CGuildManager::ChangeLadderPoint(DWORD GID, int change) snprintf(buf, sizeof(buf), "UPDATE guild%s SET ladder_point=%d WHERE id=%u", GetTablePostfix(), r.ladder_point, GID); CDBManager::instance().AsyncQuery(buf); - sys_log(0, "GuildManager::ChangeLadderPoint %u %d", GID, r.ladder_point); - sys_log(0, "%s", buf); + SPDLOG_DEBUG("GuildManager::ChangeLadderPoint {} {}", GID, r.ladder_point); + SPDLOG_DEBUG("{}", buf); // Packet º¸³»±â TPacketGuildLadder p; @@ -760,14 +760,14 @@ void CGuildManager::ChangeLadderPoint(DWORD GID, int change) void CGuildManager::UseSkill(DWORD GID, DWORD dwSkillVnum, DWORD dwCooltime) { // GUILD_SKILL_COOLTIME_BUG_FIX - sys_log(0, "UseSkill(gid=%d, skill=%d) CoolTime(%d:%d)", GID, dwSkillVnum, dwCooltime, CClientManager::instance().GetCurrentTime() + dwCooltime); + SPDLOG_DEBUG("UseSkill(gid={}, skill={}) CoolTime({}:{})", GID, dwSkillVnum, dwCooltime, CClientManager::instance().GetCurrentTime() + dwCooltime); m_pqSkill.push(std::make_pair(CClientManager::instance().GetCurrentTime() + dwCooltime, TGuildSkillUsed(GID, dwSkillVnum))); // END_OF_GUILD_SKILL_COOLTIME_BUG_FIX } void CGuildManager::MoneyChange(DWORD dwGuild, DWORD dwGold) { - sys_log(0, "GuildManager::MoneyChange %d %d", dwGuild, dwGold); + SPDLOG_DEBUG("GuildManager::MoneyChange {} {}", dwGuild, dwGold); TPacketDGGuildMoneyChange p; p.dwGuild = dwGuild; @@ -788,12 +788,12 @@ void CGuildManager::DepositMoney(DWORD dwGuild, INT iGold) if (it == m_map_kGuild.end()) { - sys_err("No guild by id %u", dwGuild); + SPDLOG_ERROR("No guild by id {}", dwGuild); return; } it->second.gold += iGold; - sys_log(0, "GUILD: %u Deposit %u Total %d", dwGuild, iGold, it->second.gold); + SPDLOG_DEBUG("GUILD: {} Deposit {} Total {}", dwGuild, iGold, it->second.gold); MoneyChange(dwGuild, it->second.gold); } @@ -804,7 +804,7 @@ void CGuildManager::WithdrawMoney(CPeer* peer, DWORD dwGuild, INT iGold) if (it == m_map_kGuild.end()) { - sys_err("No guild by id %u", dwGuild); + SPDLOG_ERROR("No guild by id {}", dwGuild); return; } @@ -812,7 +812,7 @@ void CGuildManager::WithdrawMoney(CPeer* peer, DWORD dwGuild, INT iGold) if (it->second.gold >= iGold) { it->second.gold -= iGold; - sys_log(0, "GUILD: %u Withdraw %d Total %d", dwGuild, iGold, it->second.gold); + SPDLOG_DEBUG("GUILD: {} Withdraw {} Total {}", dwGuild, iGold, it->second.gold); TPacketDGGuildMoneyWithdraw p; p.dwGuild = dwGuild; @@ -830,7 +830,7 @@ void CGuildManager::WithdrawMoneyReply(DWORD dwGuild, BYTE bGiveSuccess, INT iGo if (it == m_map_kGuild.end()) return; - sys_log(0, "GuildManager::WithdrawMoneyReply : guild %u success %d gold %d", dwGuild, bGiveSuccess, iGold); + SPDLOG_DEBUG("GuildManager::WithdrawMoneyReply : guild {} success {} gold {}", dwGuild, bGiveSuccess, iGold); if (!bGiveSuccess) it->second.gold += iGold; @@ -938,16 +938,16 @@ void CGuildManager::BootReserveWar() if (i == 0 || (int) t.dwTime - CClientManager::instance().GetCurrentTime() < 0) { if (i == 0) - sys_log(0, "%s : DB was shutdowned while war is being.", buf); + SPDLOG_DEBUG("{} : DB was shutdowned while war is being.", buf); else - sys_log(0, "%s : left time lower than 5 minutes, will be canceled", buf); + SPDLOG_DEBUG("{} : left time lower than 5 minutes, will be canceled", buf); pkReserve->Draw(); delete pkReserve; } else { - sys_log(0, "%s : OK", buf); + SPDLOG_DEBUG("{} : OK", buf); m_map_kWarReserve.insert(std::make_pair(t.dwID, pkReserve)); } } @@ -1024,7 +1024,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) polyPower.SetVar("mc", mc); t.lPowerFrom = (int) polyPower.Eval(); - sys_log(0, "GuildWar: %u lvp %d rkp %d alv %d mc %d power %d", GID1, lvp, rkp, alv, mc, t.lPowerFrom); + SPDLOG_DEBUG("GuildWar: {} lvp {} rkp {} alv {} mc {} power {}", GID1, lvp, rkp, alv, mc, t.lPowerFrom); // ÆÄ¿ö °è»ê TGuild & k2 = TouchGuild(GID2); @@ -1040,7 +1040,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) polyPower.SetVar("mc", mc); t.lPowerTo = (int) polyPower.Eval(); - sys_log(0, "GuildWar: %u lvp %d rkp %d alv %d mc %d power %d", GID2, lvp, rkp, alv, mc, t.lPowerTo); + SPDLOG_DEBUG("GuildWar: {} lvp {} rkp {} alv {} mc {} power {}", GID2, lvp, rkp, alv, mc, t.lPowerTo); // ÇÚµðĸ °è»ê if (t.lPowerTo > t.lPowerFrom) @@ -1055,7 +1055,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) } t.lHandicap = (int) polyHandicap.Eval(); - sys_log(0, "GuildWar: handicap %d", t.lHandicap); + SPDLOG_DEBUG("GuildWar: handicap {}", t.lHandicap); // Äõ¸® char szQuery[512]; @@ -1069,7 +1069,7 @@ bool CGuildManager::ReserveWar(TPacketGuildWar * p) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiInsertID == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_err("GuildWar: Cannot insert row"); + SPDLOG_ERROR("GuildWar: Cannot insert row"); return false; } @@ -1101,7 +1101,7 @@ void CGuildManager::ProcessReserveWar() TGuild & r_1 = m_map_kGuild[r.dwGuildFrom]; TGuild & r_2 = m_map_kGuild[r.dwGuildTo]; - sys_log(0, "GuildWar: started GID1 %u GID2 %u %d time %d min %d", r.dwGuildFrom, r.dwGuildTo, r.bStarted, dwCurTime - r.dwTime, iMin); + SPDLOG_DEBUG("GuildWar: started GID1 {} GID2 {} {} time {} min {}", r.dwGuildFrom, r.dwGuildTo, r.bStarted, dwCurTime - r.dwTime, iMin); if (iMin <= 0) { @@ -1152,7 +1152,7 @@ bool CGuildManager::Bet(DWORD dwID, const char * c_pszLogin, DWORD dwGold, DWORD if (it == m_map_kWarReserve.end()) { - sys_log(0, "WAR_RESERVE: Bet: cannot find reserve war by id %u", dwID); + SPDLOG_DEBUG("WAR_RESERVE: Bet: cannot find reserve war by id {}", dwID); snprintf(szQuery, sizeof(szQuery), "INSERT INTO item_award (login, vnum, socket0, given_time) VALUES('%s', %d, %u, NOW())", c_pszLogin, ITEM_ELK_VNUM, dwGold); CDBManager::instance().AsyncQuery(szQuery); @@ -1161,7 +1161,7 @@ bool CGuildManager::Bet(DWORD dwID, const char * c_pszLogin, DWORD dwGold, DWORD if (!it->second->Bet(c_pszLogin, dwGold, dwGuild)) { - sys_log(0, "WAR_RESERVE: Bet: cannot bet id %u, login %s, gold %u, guild %u", dwID, c_pszLogin, dwGold, dwGuild); + SPDLOG_DEBUG("WAR_RESERVE: Bet: cannot bet id {}, login {}, gold {}, guild {}", dwID, c_pszLogin, dwGold, dwGuild); snprintf(szQuery, sizeof(szQuery), "INSERT INTO item_award (login, vnum, socket0, given_time) VALUES('%s', %d, %u, NOW())", c_pszLogin, ITEM_ELK_VNUM, dwGold); CDBManager::instance().AsyncQuery(szQuery); @@ -1271,19 +1271,19 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild) if (m_data.dwGuildFrom != dwGuild && m_data.dwGuildTo != dwGuild) { - sys_log(0, "GuildWarReserve::Bet: invalid guild id"); + SPDLOG_DEBUG("GuildWarReserve::Bet: invalid guild id"); return false; } if (m_data.bStarted) { - sys_log(0, "GuildWarReserve::Bet: war is already started"); + SPDLOG_DEBUG("GuildWarReserve::Bet: war is already started"); return false; } if (mapBet.find(pszLogin) != mapBet.end()) { - sys_log(0, "GuildWarReserve::Bet: failed. already bet"); + SPDLOG_DEBUG("GuildWarReserve::Bet: failed. already bet"); return false; } @@ -1295,7 +1295,7 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild) if (pmsg->Get()->uiAffectedRows == 0 || pmsg->Get()->uiAffectedRows == (uint32_t)-1) { - sys_log(0, "GuildWarReserve::Bet: failed. cannot insert row to guild_war_bet table"); + SPDLOG_DEBUG("GuildWarReserve::Bet: failed. cannot insert row to guild_war_bet table"); return false; } @@ -1311,7 +1311,7 @@ bool CGuildWarReserve::Bet(const char * pszLogin, DWORD dwGold, DWORD dwGuild) CDBManager::instance().AsyncQuery(szQuery); - sys_log(0, "GuildWarReserve::Bet: success. %s %u war_id %u bet %u : %u", pszLogin, dwGuild, m_data.dwID, m_data.dwBetFrom, m_data.dwBetTo); + SPDLOG_DEBUG("GuildWarReserve::Bet: success. {} {} war_id {} bet {} : {}", pszLogin, dwGuild, m_data.dwID, m_data.dwBetFrom, m_data.dwBetTo); mapBet.insert(std::make_pair(pszLogin, std::make_pair(dwGuild, dwGold))); TPacketGDGuildWarBet pckBet; @@ -1338,7 +1338,7 @@ void CGuildWarReserve::Draw() if (mapBet.empty()) return; - sys_log(0, "WAR_REWARD: Draw. war_id %u", m_data.dwID); + SPDLOG_DEBUG("WAR_REWARD: Draw. war_id {}", m_data.dwID); itertype(mapBet) it = mapBet.begin(); @@ -1368,7 +1368,7 @@ void CGuildWarReserve::Draw() if (iRow > 0) { - sys_log(0, "WAR_REWARD: QUERY: %s", szQuery); + SPDLOG_DEBUG("WAR_REWARD: QUERY: {}", szQuery); CDBManager::instance().AsyncQuery(szQuery); } @@ -1381,18 +1381,18 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) { DWORD dwWinner; - sys_log(0, "WAR_REWARD: End: From %u %d To %u %d", m_data.dwGuildFrom, iScoreFrom, m_data.dwGuildTo, iScoreTo); + SPDLOG_DEBUG("WAR_REWARD: End: From {} {} To {} {}", m_data.dwGuildFrom, iScoreFrom, m_data.dwGuildTo, iScoreTo); if (m_data.lPowerFrom > m_data.lPowerTo) { if (m_data.lHandicap > iScoreFrom - iScoreTo) { - sys_log(0, "WAR_REWARD: End: failed to overcome handicap, From is strong but To won"); + SPDLOG_DEBUG("WAR_REWARD: End: failed to overcome handicap, From is strong but To won"); dwWinner = m_data.dwGuildTo; } else { - sys_log(0, "WAR_REWARD: End: success to overcome handicap, From win!"); + SPDLOG_DEBUG("WAR_REWARD: End: success to overcome handicap, From win!"); dwWinner = m_data.dwGuildFrom; } } @@ -1400,12 +1400,12 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) { if (m_data.lHandicap > iScoreTo - iScoreFrom) { - sys_log(0, "WAR_REWARD: End: failed to overcome handicap, To is strong but From won"); + SPDLOG_DEBUG("WAR_REWARD: End: failed to overcome handicap, To is strong but From won"); dwWinner = m_data.dwGuildFrom; } else { - sys_log(0, "WAR_REWARD: End: success to overcome handicap, To win!"); + SPDLOG_DEBUG("WAR_REWARD: End: success to overcome handicap, To win!"); dwWinner = m_data.dwGuildTo; } } @@ -1427,17 +1427,17 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) dwWinnerBet = m_data.dwBetTo; else { - sys_err("WAR_REWARD: fatal error, winner does not exist!"); + SPDLOG_ERROR("WAR_REWARD: fatal error, winner does not exist!"); return; } if (dwWinnerBet == 0) { - sys_err("WAR_REWARD: total bet money on winner is zero"); + SPDLOG_ERROR("WAR_REWARD: total bet money on winner is zero"); return; } - sys_log(0, "WAR_REWARD: End: Total bet: %u, Winner bet: %u", dwTotalBet, dwWinnerBet); + SPDLOG_DEBUG("WAR_REWARD: End: Total bet: {}, Winner bet: {}", dwTotalBet, dwWinnerBet); itertype(mapBet) it = mapBet.begin(); @@ -1459,7 +1459,7 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) double ratio = (double) it->second.second / dwWinnerBet; // 10% ¼¼±Ý °øÁ¦ ÈÄ ºÐ¹è - sys_log(0, "WAR_REWARD: %s %u ratio %f", it->first.c_str(), it->second.second, ratio); + SPDLOG_DEBUG("WAR_REWARD: {} {} ratio {}", it->first.c_str(), it->second.second, ratio); DWORD dwGold = (DWORD) (dwTotalBet * ratio * 0.9); @@ -1480,7 +1480,7 @@ void CGuildWarReserve::End(int iScoreFrom, int iScoreTo) if (iRow > 0) { - sys_log(0, "WAR_REWARD: query: %s", szQuery); + SPDLOG_DEBUG("WAR_REWARD: query: {}", szQuery); CDBManager::instance().AsyncQuery(szQuery); } diff --git a/src/db/src/HB.cpp b/src/db/src/HB.cpp index 4caea8a..8e899fe 100644 --- a/src/db/src/HB.cpp +++ b/src/db/src/HB.cpp @@ -68,13 +68,13 @@ bool PlayerHB::Query(DWORD id) if (pos < 0) { - sys_err("cannot find %s ", szFind); - // sys_err("cannot find %s in %s", szFind, m_stCreateTableQuery.c_str()); + SPDLOG_ERROR("cannot find {} ", szFind); + // SPDLOG_ERROR("cannot find {} in {}", szFind, m_stCreateTableQuery.c_str()); return false; } snprintf(szQuery, sizeof(szQuery), "CREATE TABLE IF NOT EXISTS %s%s", szTableName, m_stCreateTableQuery.c_str() + strlen(szFind)); - // sys_log(0, "%s", szQuery); + // SPDLOG_DEBUG("{}", szQuery); std::unique_ptr pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP)); m_stTableName = szTableName; } diff --git a/src/db/src/ItemAwardManager.cpp b/src/db/src/ItemAwardManager.cpp index 6dc07a7..7012130 100644 --- a/src/db/src/ItemAwardManager.cpp +++ b/src/db/src/ItemAwardManager.cpp @@ -60,7 +60,7 @@ void ItemAwardManager::Load(SQLMsg * pMsg) strcpy(cmdStr,whyStr); //¸í·É¾î ¾ò´Â °úÁ¤¿¡¼­ ÅäÅ«¾²¸é ¿øº»µµ ÅäÅ«È­ µÇ±â ¶§¹® char command[20] = ""; strcpy(command,CClientManager::instance().GetCommand(cmdStr).c_str()); // command ¾ò±â - //sys_err("%d, %s",pItemAward->dwID,command); + //SPDLOG_ERROR("{}, {}",pItemAward->dwID,command); if( !(strcmp(command,"GIFT") )) // command °¡ GIFTÀ̸é { TPacketItemAwardInfromer giftData; @@ -74,7 +74,7 @@ void ItemAwardManager::Load(SQLMsg * pMsg) m_map_award.insert(std::make_pair(dwID, kData)); printf("ITEM_AWARD load id %u bMall %d \n", kData->dwID, kData->bMall); - sys_log(0, "ITEM_AWARD: load id %lu login %s vnum %lu count %u socket %lu", kData->dwID, kData->szLogin, kData->dwVnum, kData->dwCount, kData->dwSocket0); + SPDLOG_DEBUG("ITEM_AWARD: load id {} login {} vnum {} count {} socket {}", kData->dwID, kData->szLogin, kData->dwVnum, kData->dwCount, kData->dwSocket0); std::set & kSet = m_map_kSetAwardByLogin[kData->szLogin]; kSet.insert(kData); @@ -99,7 +99,7 @@ void ItemAwardManager::Taken(DWORD dwAwardID, DWORD dwItemID) if (it == m_map_award.end()) { - sys_log(0, "ITEM_AWARD: Taken ID not exist %lu", dwAwardID); + SPDLOG_DEBUG("ITEM_AWARD: Taken ID not exist {}", dwAwardID); return; } diff --git a/src/db/src/ItemIDRangeManager.cpp b/src/db/src/ItemIDRangeManager.cpp index 099765b..f4cf045 100644 --- a/src/db/src/ItemIDRangeManager.cpp +++ b/src/db/src/ItemIDRangeManager.cpp @@ -79,7 +79,7 @@ TItemIDRangeTable CItemIDRangeManager::GetRange() } for (int i = 0; i < 10; ++i) - sys_err("ItemIDRange: NO MORE ITEM ID RANGE"); + SPDLOG_ERROR("ItemIDRange: NO MORE ITEM ID RANGE"); return ret; } @@ -112,7 +112,7 @@ bool CItemIDRangeManager::BuildRange(DWORD dwMin, DWORD dwMax, TItemIDRangeTable if ((dwMax < dwItemMaxID) || (dwMax - dwItemMaxID < cs_dwMinimumRemainCount)) { - sys_log(0, "ItemIDRange: Build %u ~ %u start: %u\tNOT USE remain count is below %u", + SPDLOG_DEBUG("ItemIDRange: Build {} ~ {} start: {}\tNOT USE remain count is below {}", dwMin, dwMax, dwItemMaxID, cs_dwMinimumRemainCount); } else @@ -136,12 +136,12 @@ bool CItemIDRangeManager::BuildRange(DWORD dwMin, DWORD dwMax, TItemIDRangeTable if (count > 0) { - sys_err("ItemIDRange: Build: %u ~ %u\thave a item", range.dwUsableItemIDMin, range.dwMax); + SPDLOG_ERROR("ItemIDRange: Build: {} ~ {}\thave a item", range.dwUsableItemIDMin, range.dwMax); return false; } else { - sys_log(0, "ItemIDRange: Build: %u ~ %u start:%u", range.dwMin, range.dwMax, range.dwUsableItemIDMin); + SPDLOG_TRACE("ItemIDRange: Build: {} ~ {} start:{}", range.dwMin, range.dwMax, range.dwUsableItemIDMin); return true; } } diff --git a/src/db/src/ItemIDRangeManager.h b/src/db/src/ItemIDRangeManager.h index d15cd01..5ab5506 100644 --- a/src/db/src/ItemIDRangeManager.h +++ b/src/db/src/ItemIDRangeManager.h @@ -2,16 +2,18 @@ #ifndef __INC_METIN_II_ITEM_ID_RANGE_MANAGER_H__ #define __INC_METIN_II_ITEM_ID_RANGE_MANAGER_H__ +namespace { + static const uint32_t cs_dwMaxItemID = 4290000000UL; + static const uint32_t cs_dwMinimumRange = 10000000UL; + static const uint32_t cs_dwMinimumRemainCount = 10000UL; +} + class CItemIDRangeManager : public singleton { - private : - const static DWORD cs_dwMaxItemID = 4290000000UL; - const static DWORD cs_dwMinimumRange = 10000000UL; - const static DWORD cs_dwMinimumRemainCount = 10000UL; - + private: std::list m_listData; - public : + public: CItemIDRangeManager(); void Build(); diff --git a/src/db/src/LoginData.cpp b/src/db/src/LoginData.cpp index 60a683f..dbcec54 100644 --- a/src/db/src/LoginData.cpp +++ b/src/db/src/LoginData.cpp @@ -78,11 +78,11 @@ void CLoginData::SetPlay(bool bOn) { if (bOn) { - sys_log(0, "SetPlay on %lu %s", GetKey(), m_data.login); + SPDLOG_DEBUG("SetPlay on {} {}", GetKey(), m_data.login); SetLogonTime(); } else - sys_log(0, "SetPlay off %lu %s", GetKey(), m_data.login); + SPDLOG_DEBUG("SetPlay off {} {}", GetKey(), m_data.login); m_bPlay = bOn; m_lastPlayTime = CClientManager::instance().GetCurrentTime(); diff --git a/src/db/src/Main.cpp b/src/db/src/Main.cpp index a51d836..e08eaad 100644 --- a/src/db/src/Main.cpp +++ b/src/db/src/Main.cpp @@ -38,8 +38,6 @@ int g_iItemCacheFlushSeconds = 60*5; //g_iLogoutSeconds ¼öÄ¡´Â g_iPlayerCacheFlushSeconds ¿Í g_iItemCacheFlushSeconds º¸´Ù ±æ¾î¾ß ÇÑ´Ù. int g_iLogoutSeconds = 60*10; -int g_log = 1; - // MYSHOP_PRICE_LIST int g_iItemPriceListTableCacheFlushSeconds = 540; @@ -52,9 +50,9 @@ extern const char * _malloc_options; void emergency_sig(int sig) { if (sig == SIGSEGV) - sys_log(0, "SIGNAL: SIGSEGV"); + SPDLOG_DEBUG("SIGNAL: SIGSEGV"); else if (sig == SIGUSR1) - sys_log(0, "SIGNAL: SIGUSR1"); + SPDLOG_DEBUG("SIGNAL: SIGUSR1"); if (sig == SIGSEGV) abort(); @@ -93,7 +91,7 @@ int main() #ifdef __AUCTION__ AuctionManager::instance().Initialize(); #endif - sys_log(0, "Metin2DBCacheServer Start\n"); + SPDLOG_DEBUG("Metin2DBCacheServer Start"); CClientManager::instance().MainLoop(); @@ -113,7 +111,7 @@ int main() break; usleep(1000); - sys_log(0, "WAITING_QUERY_COUNT %d", iCount); + SPDLOG_DEBUG("WAITING_QUERY_COUNT {}", iCount); } return 1; @@ -144,18 +142,6 @@ int Start() else SPDLOG_INFO("Test Server"); - if (!CConfig::instance().GetValue("LOG", &g_log)) - { - SPDLOG_INFO("Log Off"); - g_log= 0; - } - else - { - g_log = 1; - SPDLOG_INFO("Log On"); - } - - int tmpValue; int heart_beat = 50; @@ -286,7 +272,7 @@ int Start() if (CConfig::instance().GetValue("SQL_ACCOUNT", line, 256)) { sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - sys_log(0, "connecting to MySQL server (account)"); + SPDLOG_DEBUG("connecting to MySQL server (account)"); int iRetry = 5; @@ -294,26 +280,26 @@ int Start() { if (CDBManager::instance().Connect(SQL_ACCOUNT, szAddr, iPort, szDB, szUser, szPassword)) { - sys_log(0, " OK"); + SPDLOG_DEBUG(" OK"); break; } - sys_log(0, " failed, retrying in 5 seconds"); - fprintf(stderr, " failed, retrying in 5 seconds"); + SPDLOG_DEBUG(" failed, retrying in 5 seconds"); + SPDLOG_ERROR(" failed, retrying in 5 seconds"); sleep(5); } while (iRetry--); - fprintf(stderr, "Success ACCOUNT\n"); + SPDLOG_INFO("Success ACCOUNT"); } else { - sys_err("SQL_ACCOUNT not configured"); + SPDLOG_ERROR("SQL_ACCOUNT not configured"); return false; } if (CConfig::instance().GetValue("SQL_COMMON", line, 256)) { sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - sys_log(0, "connecting to MySQL server (common)"); + SPDLOG_DEBUG("connecting to MySQL server (common)"); int iRetry = 5; @@ -321,26 +307,26 @@ int Start() { if (CDBManager::instance().Connect(SQL_COMMON, szAddr, iPort, szDB, szUser, szPassword)) { - sys_log(0, " OK"); + SPDLOG_DEBUG(" OK"); break; } - sys_log(0, " failed, retrying in 5 seconds"); - fprintf(stderr, " failed, retrying in 5 seconds"); + SPDLOG_DEBUG(" failed, retrying in 5 seconds"); + SPDLOG_ERROR(" failed, retrying in 5 seconds"); sleep(5); } while (iRetry--); - fprintf(stderr, "Success COMMON\n"); + SPDLOG_INFO("Success COMMON"); } else { - sys_err("SQL_COMMON not configured"); + SPDLOG_ERROR("SQL_COMMON not configured"); return false; } if (CConfig::instance().GetValue("SQL_HOTBACKUP", line, 256)) { sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort); - sys_log(0, "connecting to MySQL server (hotbackup)"); + SPDLOG_DEBUG("connecting to MySQL server (hotbackup)"); int iRetry = 5; @@ -348,21 +334,21 @@ int Start() { if (CDBManager::instance().Connect(SQL_HOTBACKUP, szAddr, iPort, szDB, szUser, szPassword)) { - sys_log(0, " OK"); + SPDLOG_DEBUG(" OK"); break; } - sys_log(0, " failed, retrying in 5 seconds"); - fprintf(stderr, " failed, retrying in 5 seconds"); + SPDLOG_DEBUG(" failed, retrying in 5 seconds"); + SPDLOG_ERROR(" failed, retrying in 5 seconds"); sleep(5); } while (iRetry--); - fprintf(stderr, "Success HOTBACKUP\n"); + SPDLOG_INFO("Success HOTBACKUP"); } else { - sys_err("SQL_HOTBACKUP not configured"); + SPDLOG_ERROR("SQL_HOTBACKUP not configured"); return false; } diff --git a/src/db/src/Marriage.cpp b/src/db/src/Marriage.cpp index d094ed2..f42df95 100644 --- a/src/db/src/Marriage.cpp +++ b/src/db/src/Marriage.cpp @@ -44,7 +44,7 @@ namespace marriage unique_ptr pmsg(CDBManager::instance().DirectQuery(szQuery)); SQLResult * pRes = pmsg->Get(); - sys_log(0, "MarriageList(size=%lu)", pRes->uiNumRows); + SPDLOG_DEBUG("MarriageList(size={})", pRes->uiNumRows); if (pRes->uiNumRows > 0) { @@ -65,7 +65,7 @@ namespace marriage m_MarriageByPID.insert(make_pair(pid1, pMarriage)); m_MarriageByPID.insert(make_pair(pid2, pMarriage)); - sys_log(0, "Marriage %lu: LP:%d TM:%u ST:%d %10lu:%16s %10lu:%16s ", uiRow, love_point, time, is_married, pid1, name1, pid2, name2); + SPDLOG_DEBUG("Marriage {}: LP:{} TM:{} ST:{} {:10}:{:16} {:10}:{:16} ", uiRow, love_point, time, is_married, pid1, name1, pid2, name2); } } return true; @@ -92,7 +92,7 @@ namespace marriage DWORD now = CClientManager::instance().GetCurrentTime(); if (IsMarried(dwPID1) || IsMarried(dwPID2)) { - sys_err("cannot marry already married character. %d - %d", dwPID1, dwPID2); + SPDLOG_ERROR("cannot marry already married character. {} - {}", dwPID1, dwPID2); return; } @@ -106,11 +106,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot insert marriage"); + SPDLOG_ERROR("cannot insert marriage"); return; } - sys_log(0, "MARRIAGE ADD %u %u", dwPID1, dwPID2); + SPDLOG_DEBUG("MARRIAGE ADD {} {}", dwPID1, dwPID2); TMarriage* pMarriage = new TMarriage(dwPID1, dwPID2, 0, now, 0, szName1, szName2); m_Marriages.insert(pMarriage); @@ -131,7 +131,7 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("not under marriage : %u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : {} {}", dwPID1, dwPID2); return; } @@ -146,11 +146,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot update marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("cannot update marriage : PID:{} {}", dwPID1, dwPID2); return; } - sys_log(0, "MARRIAGE UPDATE PID:%u %u LP:%u ST:%d", dwPID1, dwPID2, iLovePoint, byMarried); + SPDLOG_DEBUG("MARRIAGE UPDATE PID:{} {} LP:{} ST:{}", dwPID1, dwPID2, iLovePoint, byMarried); pMarriage->love_point = iLovePoint; pMarriage->is_married = byMarried; @@ -168,7 +168,7 @@ namespace marriage if (pMarriage) { - sys_log(0, "Break Marriage pid1 %d pid2 %d Other %d", dwPID1, dwPID2, pMarriage->GetOther(dwPID1)); + SPDLOG_DEBUG("Break Marriage pid1 {} pid2 {} Other {}", dwPID1, dwPID2, pMarriage->GetOther(dwPID1)); } if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { @@ -176,9 +176,9 @@ namespace marriage for (; it != m_MarriageByPID.end(); ++it) { - sys_log(0, "Marriage List pid1 %d pid2 %d", it->second->pid1, it->second->pid2); + SPDLOG_DEBUG("Marriage List pid1 {} pid2 {}", it->second->pid1, it->second->pid2); } - sys_err("not under marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : PID:{} {}", dwPID1, dwPID2); return; } @@ -192,11 +192,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot delete marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("cannot delete marriage : PID:{} {}", dwPID1, dwPID2); return; } - sys_log(0, "MARRIAGE REMOVE PID:%u %u", dwPID1, dwPID2); + SPDLOG_DEBUG("MARRIAGE REMOVE PID:{} {}", dwPID1, dwPID2); m_Marriages.erase(pMarriage); m_MarriageByPID.erase(dwPID1); @@ -215,13 +215,13 @@ namespace marriage TMarriage* pMarriage = Get(dwPID1); if (!pMarriage || pMarriage->GetOther(dwPID1) != dwPID2) { - sys_err("not under marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("not under marriage : PID:{} {}", dwPID1, dwPID2); return; } if (pMarriage->is_married) { - sys_err("already married, cannot change engage to marry : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("already married, cannot change engage to marry : PID:{} {}", dwPID1, dwPID2); return; } @@ -236,11 +236,11 @@ namespace marriage SQLResult* res = pmsg->Get(); if (res->uiAffectedRows == 0 || res->uiAffectedRows == (uint32_t)-1) { - sys_err("cannot change engage to marriage : PID:%u %u", dwPID1, dwPID2); + SPDLOG_ERROR("cannot change engage to marriage : PID:{} {}", dwPID1, dwPID2); return; } - sys_log(0, "MARRIAGE ENGAGE->MARRIAGE PID:%u %u", dwPID1, dwPID2); + SPDLOG_DEBUG("MARRIAGE ENGAGE->MARRIAGE PID:{} {}", dwPID1, dwPID2); pMarriage->is_married = 1; TPacketMarriageUpdate p; @@ -313,7 +313,7 @@ namespace marriage itertype(m_mapRunningWedding) it = m_mapRunningWedding.find(make_pair(dwPID1, dwPID2)); if (it == m_mapRunningWedding.end()) { - sys_err("try to end wedding %u %u", dwPID1, dwPID2); + SPDLOG_ERROR("try to end wedding {} {}", dwPID1, dwPID2); return; } diff --git a/src/db/src/Monarch.cpp b/src/db/src/Monarch.cpp index 13b2968..3c38fe7 100644 --- a/src/db/src/Monarch.cpp +++ b/src/db/src/Monarch.cpp @@ -1,3 +1,5 @@ +#include "stdafx.h" + #include "Monarch.h" #include #include "Main.h" @@ -53,8 +55,7 @@ void CMonarch::ElectMonarch() ++s[idx]; - if (g_test_server) - sys_log (0, "[MONARCH_VOTE] pid(%d) come to vote candidacy pid(%d)", it->second->pid, m_vec_MonarchCandidacy[idx].pid); + SPDLOG_TRACE("[MONARCH_VOTE] pid({}) come to vote candidacy pid({})", it->second->pid, m_vec_MonarchCandidacy[idx].pid); } delete [] s; @@ -167,8 +168,7 @@ bool CMonarch::TakeMoney(int Empire, DWORD pid, int64_t Money) CDBManager::instance().AsyncQuery(szQuery); - if (g_test_server) - sys_log(0, "[MONARCH] Take money empire(%d) money(%lld)", Empire, m_MonarchInfo.money[Empire]); + SPDLOG_TRACE("[MONARCH] Take money empire({}) money({})", Empire, m_MonarchInfo.money[Empire]); return true; } @@ -197,8 +197,7 @@ bool CMonarch::LoadMonarch() str_to_number(p->money[Empire], row[idx++]); strlcpy(p->date[Empire], row[idx++], sizeof(p->date[Empire])); - if (g_test_server) - sys_log(0, "[LOAD_MONARCH] Empire %d pid %d money %lld windate %s", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); + SPDLOG_TRACE("[LOAD_MONARCH] Empire {} pid {} money {} windate {}", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); } delete pMsg; @@ -230,8 +229,7 @@ bool CMonarch::SetMonarch(const char * name) strlcpy(p->name[Empire], row[idx++], sizeof(p->name[Empire])); p->money[Empire] = atoll(row[idx++]); - if (g_test_server) - sys_log(0, "[Set_MONARCH] Empire %d pid %d money %lld windate %s", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); + SPDLOG_TRACE("[Set_MONARCH] Empire {} pid {} money {} windate {}", Empire, p->pid[Empire], p->money[Empire], p->date[Empire]); } delete pMsg; @@ -278,7 +276,7 @@ bool CMonarch::DelMonarch(const char * name) if (pMsg->Get()->uiNumRows == 0) { - sys_err(" DirectQuery failed(%s)", szQuery); + SPDLOG_ERROR(" DirectQuery failed({})", szQuery); delete pMsg; return false; } diff --git a/src/db/src/Peer.cpp b/src/db/src/Peer.cpp index 1801102..bcbe2cc 100644 --- a/src/db/src/Peer.cpp +++ b/src/db/src/Peer.cpp @@ -29,15 +29,15 @@ void CPeer::OnAccept() static DWORD current_handle = 0; m_dwHandle = ++current_handle; - sys_log(0, "Connection accepted. (host: %s handle: %u)", m_host, m_dwHandle); + SPDLOG_DEBUG("Connection accepted. (host: {} handle: {})", m_host, m_dwHandle); } void CPeer::OnClose() { m_state = STATE_CLOSE; - sys_log(0, "Connection closed. (host: %s)", m_host); - sys_log(0, "ItemIDRange: returned. %u ~ %u", m_itemRange.dwMin, m_itemRange.dwMax); + SPDLOG_DEBUG("Connection closed. (host: {})", m_host); + SPDLOG_DEBUG("ItemIDRange: returned. {} ~ {}", m_itemRange.dwMin, m_itemRange.dwMax); CItemIDRangeManager::instance().UpdateRange(m_itemRange.dwMin, m_itemRange.dwMax); @@ -69,7 +69,7 @@ bool CPeer::PeekPacket(int & iBytesProceed, BYTE & header, DWORD & dwHandle, DWO const char * buf = (const char *) GetRecvBuffer(iBytesProceed + 9); if (!buf) { - sys_err("PeekPacket: Failed to get network buffer!"); + SPDLOG_ERROR("PeekPacket: Failed to get network buffer!"); return false; } @@ -87,7 +87,7 @@ bool CPeer::PeekPacket(int & iBytesProceed, BYTE & header, DWORD & dwHandle, DWO // Ensure that all the data was fully received if (iBytesProceed + dwLength + 9 > (DWORD) GetRecvLength()) { - sys_log(0, "PeekPacket: not enough buffer size: len %u, recv %d", + SPDLOG_DEBUG("PeekPacket: not enough buffer size: len {}, recv {}", 9+dwLength, GetRecvLength()-iBytesProceed); return false; } @@ -95,7 +95,7 @@ bool CPeer::PeekPacket(int & iBytesProceed, BYTE & header, DWORD & dwHandle, DWO // Ensure that all the required data is available in a contiguous area buf = (const char *) GetRecvBuffer(iBytesProceed + dwLength + 9); if (!buf) { - sys_err("PeekPacket: Failed to get network buffer!"); + SPDLOG_ERROR("PeekPacket: Failed to get network buffer!"); return false; } @@ -112,7 +112,7 @@ void CPeer::EncodeHeader(BYTE header, DWORD dwHandle, DWORD dwSize) { HEADER h; - sys_log(1, "EncodeHeader %u handle %u size %u", header, dwHandle, dwSize); + SPDLOG_TRACE("EncodeHeader {} handle {} size {}", header, dwHandle, dwSize); h.bHeader = header; h.dwHandle = dwHandle; @@ -149,7 +149,7 @@ void CPeer::SendSpareItemIDRange() if (SetSpareItemIDRange(CItemIDRangeManager::instance().GetRange()) == false) { - sys_log(0, "ItemIDRange: spare range set error"); + SPDLOG_DEBUG("ItemIDRange: spare range set error"); m_itemSpareRange.dwMin = m_itemSpareRange.dwMax = m_itemSpareRange.dwUsableItemIDMin = 0; } @@ -163,7 +163,7 @@ bool CPeer::SetItemIDRange(TItemIDRangeTable itemRange) if (itemRange.dwMin == 0 || itemRange.dwMax == 0 || itemRange.dwUsableItemIDMin == 0) return false; m_itemRange = itemRange; - sys_log(0, "ItemIDRange: SET %s %u ~ %u start: %u", GetPublicIP(), m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); + SPDLOG_DEBUG("ItemIDRange: SET {} {} ~ {} start: {}", GetPublicIP(), m_itemRange.dwMin, m_itemRange.dwMax, m_itemRange.dwUsableItemIDMin); return true; } @@ -173,7 +173,7 @@ bool CPeer::SetSpareItemIDRange(TItemIDRangeTable itemRange) if (itemRange.dwMin == 0 || itemRange.dwMax == 0 || itemRange.dwUsableItemIDMin == 0) return false; m_itemSpareRange = itemRange; - sys_log(0, "ItemIDRange: SPARE SET %s %u ~ %u start: %u", GetPublicIP(), m_itemSpareRange.dwMin, m_itemSpareRange.dwMax, + SPDLOG_DEBUG("ItemIDRange: SPARE SET {} {} ~ {} start: {}", GetPublicIP(), m_itemSpareRange.dwMin, m_itemSpareRange.dwMax, m_itemSpareRange.dwUsableItemIDMin); return true; @@ -183,14 +183,14 @@ bool CPeer::CheckItemIDRangeCollision(TItemIDRangeTable itemRange) { if (m_itemRange.dwMin < itemRange.dwMax && m_itemRange.dwMax > itemRange.dwMin) { - sys_err("ItemIDRange: Collision!! this %u ~ %u check %u ~ %u", + SPDLOG_ERROR("ItemIDRange: Collision!! this {} ~ {} check {} ~ {}", m_itemRange.dwMin, m_itemRange.dwMax, itemRange.dwMin, itemRange.dwMax); return false; } if (m_itemSpareRange.dwMin < itemRange.dwMax && m_itemSpareRange.dwMax > itemRange.dwMin) { - sys_err("ItemIDRange: Collision with spare range this %u ~ %u check %u ~ %u", + SPDLOG_ERROR("ItemIDRange: Collision with spare range this {} ~ {} check {} ~ {}", m_itemSpareRange.dwMin, m_itemSpareRange.dwMax, itemRange.dwMin, itemRange.dwMax); return false; } diff --git a/src/db/src/PeerBase.cpp b/src/db/src/PeerBase.cpp index 1e039d2..7335f74 100644 --- a/src/db/src/PeerBase.cpp +++ b/src/db/src/PeerBase.cpp @@ -23,12 +23,12 @@ void CPeerBase::Destroy() bool CPeerBase::Accept(bufferevent* bufev, sockaddr* addr) { if (!bufev) { - sys_err("Cannot accept empty bufferevent!"); + SPDLOG_ERROR("Cannot accept empty bufferevent!"); return false; } if (m_bufferevent != nullptr) { - sys_err("Peer is already initialized"); + SPDLOG_ERROR("Peer is already initialized"); return false; } @@ -57,7 +57,7 @@ bool CPeerBase::Accept(bufferevent* bufev, sockaddr* addr) // Trigger the OnAccept event OnAccept(); - sys_log(0, "ACCEPT FROM %s", m_host); + SPDLOG_DEBUG("ACCEPT FROM {}", m_host); return true; } @@ -86,12 +86,12 @@ void CPeerBase::Encode(const void* data, size_t size) { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return; } if (bufferevent_write(m_bufferevent, data, size) != 0) { - sys_err("Buffer write error!"); + SPDLOG_ERROR("Buffer write error!"); return; } } @@ -100,7 +100,7 @@ void CPeerBase::RecvEnd(size_t proceed_bytes) { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return; } @@ -112,7 +112,7 @@ size_t CPeerBase::GetRecvLength() { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return 0; } @@ -124,7 +124,7 @@ const void * CPeerBase::GetRecvBuffer(ssize_t ensure_bytes) { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return nullptr; } @@ -136,7 +136,7 @@ size_t CPeerBase::GetSendLength() { if (!m_bufferevent) { - sys_err("Bufferevent not ready!"); + SPDLOG_ERROR("Bufferevent not ready!"); return 0; } diff --git a/src/db/src/PrivManager.cpp b/src/db/src/PrivManager.cpp index c3a373f..ede3c4e 100644 --- a/src/db/src/PrivManager.cpp +++ b/src/db/src/PrivManager.cpp @@ -84,7 +84,7 @@ void CPrivManager::AddCharPriv(DWORD pid, BYTE type, int value) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: AddCharPriv: wrong char priv type(%u) recved", type); + SPDLOG_ERROR("PRIV_MANAGER: AddCharPriv: wrong char priv type({}) recved", type); return; } @@ -108,7 +108,7 @@ void CPrivManager::AddCharPriv(DWORD pid, BYTE type, int value) m_aPrivChar[type].insert(std::make_pair(pid, p)); // TODO send packet - sys_log(0, "AddCharPriv %d %d %d", pid, type, value); + SPDLOG_DEBUG("AddCharPriv {} {} {}", pid, type, value); SendChangeCharPriv(pid, type, value); } @@ -119,7 +119,7 @@ void CPrivManager::AddGuildPriv(DWORD guild_id, BYTE type, int value, time_t dur { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: AddGuildPriv: wrong guild priv type(%u) recved", type); + SPDLOG_ERROR("PRIV_MANAGER: AddGuildPriv: wrong guild priv type({}) recved", type); return; } @@ -141,14 +141,14 @@ void CPrivManager::AddGuildPriv(DWORD guild_id, BYTE type, int value, time_t dur SendChangeGuildPriv(guild_id, type, value, end); // END_OF_ADD_GUILD_PRIV_TIME - sys_log(0, "Guild Priv guild(%d) type(%d) value(%d) duration_sec(%d)", guild_id, type, value, duration_sec); + SPDLOG_DEBUG("Guild Priv guild({}) type({}) value({}) duration_sec({})", guild_id, type, value, duration_sec); } void CPrivManager::AddEmpirePriv(BYTE empire, BYTE type, int value, time_t duration_sec) { if (MAX_PRIV_NUM <= type) { - sys_err("PRIV_MANAGER: AddEmpirePriv: wrong empire priv type(%u) recved", type); + SPDLOG_ERROR("PRIV_MANAGER: AddEmpirePriv: wrong empire priv type({}) recved", type); return; } @@ -173,7 +173,7 @@ void CPrivManager::AddEmpirePriv(BYTE empire, BYTE type, int value, time_t durat SendChangeEmpirePriv(empire, type, value, end); // END_OF_ADD_EMPIRE_PRIV_TIME - sys_log(0, "Empire Priv empire(%d) type(%d) value(%d) duration_sec(%d)", empire, type, value, duration_sec); + SPDLOG_DEBUG("Empire Priv empire({}) type({}) value({}) duration_sec({})", empire, type, value, duration_sec); } /** diff --git a/src/db/src/ProtoReader.cpp b/src/db/src/ProtoReader.cpp index 859215f..21cdb22 100644 --- a/src/db/src/ProtoReader.cpp +++ b/src/db/src/ProtoReader.cpp @@ -206,7 +206,7 @@ int get_Item_SubType_Value(int type_value, string inputString) // assert ¾È ¸ÔÈ÷´Â µí.. if (_countof(arSubType) <= type_value) { - sys_err("SubType : Out of range!! (type_value: %d, count of registered subtype: %d", type_value, _countof(arSubType)); + SPDLOG_ERROR("SubType : Out of range!! (type_value: {}, count of registered subtype: {}", type_value, _countof(arSubType)); return -1; } @@ -683,7 +683,7 @@ bool Set_Proto_Mob_Table(TMobTable *mobTable, cCsvTable &csvTable,std::mapbDeathBlowPoint, csvTable.AsStringByIndex(col++)); str_to_number(mobTable->bRevivePoint, csvTable.AsStringByIndex(col++)); - sys_log(0, "MOB #%-5d %-24s level: %-3u rank: %u empire: %d", mobTable->dwVnum, mobTable->szLocaleName, mobTable->bLevel, mobTable->bRank, mobTable->bEmpire); + SPDLOG_TRACE("MOB #{:<5} {:24} level: {:<3} rank: {} empire: {}", mobTable->dwVnum, mobTable->szLocaleName, mobTable->bLevel, mobTable->bRank, mobTable->bEmpire); return true; } @@ -739,9 +739,9 @@ bool Set_Proto_Item_Table(TItemTable *itemTable, cCsvTable &csvTable,std::mapdwVnum = start_vnum; diff --git a/src/db/src/stdafx.h b/src/db/src/stdafx.h index 6d90277..df0b38d 100644 --- a/src/db/src/stdafx.h +++ b/src/db/src/stdafx.h @@ -17,8 +17,6 @@ #include #include -#include - #include #include #include diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index fb95bdf..d38d96d 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -47,10 +47,6 @@ target_link_libraries(${PROJECT_NAME} effolkronium_random) find_package(fmt CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} fmt::fmt) -# spdlog -find_package(spdlog CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} spdlog::spdlog) - # # System-provided dependencies # diff --git a/src/game/src/dragon_soul_table.cpp b/src/game/src/dragon_soul_table.cpp index 5da74db..e9909e3 100644 --- a/src/game/src/dragon_soul_table.cpp +++ b/src/game/src/dragon_soul_table.cpp @@ -113,7 +113,7 @@ bool DragonSoulTable::ReadVnumMapper() int n = pGroupNode->GetRowCount(); if (0 == n) { - sys_err ("Group VnumMapper is Empty."); + SPDLOG_ERROR("Group VnumMapper is Empty."); return false; } diff --git a/src/game/src/input_main.cpp b/src/game/src/input_main.cpp index 5ca4e06..dd137e6 100644 --- a/src/game/src/input_main.cpp +++ b/src/game/src/input_main.cpp @@ -1671,7 +1671,7 @@ void CInputMain::Move(LPCHARACTER ch, const char * data) */ /* SPDLOG_TRACE( - "MOVE: %s Func:%u Arg:%u Pos:%dx%d Time:%u Dist:%.1f", + "MOVE: {} Func:{} Arg:{} Pos:{}x{} Time:{} Dist:{:.1f}", ch->GetName(), pinfo->bFunc, pinfo->bArg, diff --git a/src/game/src/item_manager.cpp b/src/game/src/item_manager.cpp index e8ff4d7..90e0d53 100644 --- a/src/game/src/item_manager.cpp +++ b/src/game/src/item_manager.cpp @@ -1188,14 +1188,13 @@ static void __DropEvent_CharStone_DropItem(CHARACTER & killer, CHARACTER & victi if (Random::get(1, MaxRange) <= dropPercent) { - int log_level = (test_server || killer.GetGMLevel() >= GM_LOW_WIZARD) ? 0 : 1; int victim_level = victim.GetLevel(); int level_diff = victim_level - killer_level; if (level_diff >= +gs_dropEvent_charStone.level_range || level_diff <= -gs_dropEvent_charStone.level_range) { - sys_log(log_level, - "dropevent.drop_char_stone.level_range_over: killer(%s: lv%d), victim(%s: lv:%d), level_diff(%d)", + SPDLOG_DEBUG( + "dropevent.drop_char_stone.level_range_over: killer({}: lv{}), victim({}: lv:{}), level_diff({})", killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff); return; } @@ -1209,8 +1208,8 @@ static void __DropEvent_CharStone_DropItem(CHARACTER & killer, CHARACTER & victi { vec_item.push_back(p_item); - sys_log(log_level, - "dropevent.drop_char_stone.item_drop: killer(%s: lv%d), victim(%s: lv:%d), item_name(%s)", + SPDLOG_DEBUG( + "dropevent.drop_char_stone.item_drop: killer({}: lv{}), victim({}: lv:{}), item_name({})", killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), p_item->GetName()); } } @@ -1295,8 +1294,8 @@ static LPITEM __DropEvent_RefineBox_GetDropItem(CHARACTER & killer, CHARACTER & //if (level_diff >= +gs_dropEvent_refineBox.level_range || level_diff <= -gs_dropEvent_refineBox.level_range) //{ - // sys_log(log_level, - // "dropevent.drop_refine_box.level_range_over: killer(%s: lv%d), victim(%s: lv:%d), level_diff(%d)", + // SPDLOG_DEBUG( + // "dropevent.drop_refine_box.level_range_over: killer({}: lv{}), victim({}: lv:{}), level_diff({})", // killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), level_diff); // return NULL; //} @@ -1330,16 +1329,14 @@ static void __DropEvent_RefineBox_DropItem(CHARACTER & killer, CHARACTER & victi if (!gs_dropEvent_refineBox.alive) return; - int log_level = (test_server || killer.GetGMLevel() >= GM_LOW_WIZARD) ? 0 : 1; - LPITEM p_item = __DropEvent_RefineBox_GetDropItem(killer, victim, itemMgr); if (p_item) { vec_item.push_back(p_item); - sys_log(log_level, - "dropevent.drop_refine_box.item_drop: killer(%s: lv%d), victim(%s: lv:%d), item_name(%s)", + SPDLOG_DEBUG( + "dropevent.drop_refine_box.item_drop: killer({}: lv{}), victim({}: lv:{}), item_name({})", killer.GetName(), killer.GetLevel(), victim.GetName(), victim.GetLevel(), p_item->GetName()); } } diff --git a/src/game/src/main.cpp b/src/game/src/main.cpp index 7284f2c..fd79c68 100644 --- a/src/game/src/main.cpp +++ b/src/game/src/main.cpp @@ -790,14 +790,12 @@ int idle() if (!io_loop(ev_base)) return 0; s_dwProfiler[PROF_IO] += (get_dword_time() - t); - log_rotate(); - gettimeofday(&now, (struct timezone *) 0); ++process_time_count; if (now.tv_sec - pta.tv_sec > 0) { - pt_log("[%3d] event %5d/%-5d idle %-4ld event %-4ld heartbeat %-4ld I/O %-4ld chrUpate %-4ld | WRITE: %-7d | PULSE: %d", + SPDLOG_TRACE("[{:3}] event {:5}/{:<5} idle {:<4} event {:<4} heartbeat {:<4} I/O {:<4} chrUpate {:<4} | WRITE: {:<7} | PULSE: {}", process_time_count, num_events_called, event_count(), diff --git a/src/game/src/questmanager.cpp b/src/game/src/questmanager.cpp index 054b62a..e9ceb2f 100644 --- a/src/game/src/questmanager.cpp +++ b/src/game/src/questmanager.cpp @@ -1648,7 +1648,7 @@ namespace quest vsnprintf(szMsg, sizeof(szMsg), fmt, args); va_end(args); - _sys_err(func, line, "%s", szMsg); + SPDLOG_ERROR("Quest error occurred in [{}:{}}]: {}", func, line, szMsg); if (test_server) { LPCHARACTER ch = GetCurrentCharacterPtr(); diff --git a/src/game/src/stdafx.h b/src/game/src/stdafx.h index bdd77ca..375c48c 100644 --- a/src/game/src/stdafx.h +++ b/src/game/src/stdafx.h @@ -14,8 +14,6 @@ #include #include -#include - #include #include #include diff --git a/src/libsql/src/CAsyncSQL.cpp b/src/libsql/src/CAsyncSQL.cpp index 2e8ba64..2d42506 100644 --- a/src/libsql/src/CAsyncSQL.cpp +++ b/src/libsql/src/CAsyncSQL.cpp @@ -44,7 +44,7 @@ void CAsyncSQL::Destroy() { if (m_hDB.host) { - sys_log(0, "AsyncSQL: closing mysql connection."); + SPDLOG_INFO("AsyncSQL: closing mysql connection."); mysql_close(&m_hDB); m_hDB.host = NULL; } @@ -91,23 +91,23 @@ bool CAsyncSQL::QueryLocaleSet() { if (0 == m_stLocale.length()) { - sys_err("m_stLocale == 0"); + SPDLOG_TRACE("m_stLocale == 0"); return true; } else if (m_stLocale == "ascii") { - sys_err("m_stLocale == ascii"); + SPDLOG_TRACE("m_stLocale == ascii"); return true; } if (mysql_set_character_set(&m_hDB, m_stLocale.c_str())) { - sys_err("cannot set locale %s by 'mysql_set_character_set', errno %u %s", m_stLocale.c_str(), mysql_errno(&m_hDB) , mysql_error(&m_hDB)); + SPDLOG_ERROR("cannot set locale {} by 'mysql_set_character_set', errno {} {}", m_stLocale, mysql_errno(&m_hDB) , mysql_error(&m_hDB)); return false; } - sys_log(0, "\t--mysql_set_character_set(%s)", m_stLocale.c_str()); + SPDLOG_TRACE("\t--mysql_set_character_set({})", m_stLocale); return true; } @@ -116,7 +116,7 @@ bool CAsyncSQL::Connect() { if (0 == mysql_init(&m_hDB)) { - fprintf(stderr, "mysql_init failed\n"); + SPDLOG_CRITICAL("mysql_init failed"); return false; } @@ -128,22 +128,22 @@ bool CAsyncSQL::Connect() //mysql_options(&m_hDB, MYSQL_SET_CHARSET_DIR , "/usr/local/share/mysql"); if (mysql_options(&m_hDB, MYSQL_SET_CHARSET_NAME, m_stLocale.c_str()) != 0) { - fprintf(stderr, "mysql_option failed : MYSQL_SET_CHARSET_NAME %s ", mysql_error(&m_hDB)); + SPDLOG_ERROR("Setting MYSQL_SET_CHARSET_NAME via mysql_options failed: {}", mysql_error(&m_hDB)); } } if (!mysql_real_connect(&m_hDB, m_stHost.c_str(), m_stUser.c_str(), m_stPassword.c_str(), m_stDB.c_str(), m_iPort, NULL, CLIENT_MULTI_STATEMENTS)) { - fprintf(stderr, "mysql_real_connect: %s\n", mysql_error(&m_hDB)); + SPDLOG_ERROR("MySQL connection failed: {}", mysql_error(&m_hDB)); return false; } bool reconnect = true; if (0 != mysql_options(&m_hDB, MYSQL_OPT_RECONNECT, &reconnect)) - fprintf(stderr, "mysql_option: %s\n", mysql_error(&m_hDB)); + SPDLOG_ERROR("Setting MYSQL_OPT_RECONNECT via mysql_options failed: {}", mysql_error(&m_hDB)); - fprintf(stdout, "AsyncSQL: connected to %s (reconnect %d)\n", m_stHost.c_str(), m_hDB.reconnect); + SPDLOG_INFO("AsyncSQL: connected to {} (reconnect {})", m_stHost, m_hDB.reconnect); // db cache´Â common dbÀÇ LOCALE Å×ÀÌºí¿¡¼­ localeÀ» ¾Ë¾Æ¿À°í, ÀÌÈÄ character setÀ» ¼öÁ¤ÇÑ´Ù. // µû¶ó¼­ ÃÖÃÊ ConnectionÀ» ¸ÎÀ» ¶§¿¡´Â localeÀ» ¸ð¸£±â ¶§¹®¿¡ character setÀ» Á¤ÇÒ ¼ö°¡ ¾øÀ½¿¡µµ ºÒ±¸ÇÏ°í, @@ -178,7 +178,7 @@ bool CAsyncSQL::Setup(const char * c_pszHost, const char * c_pszUser, const char if (c_pszLocale) { m_stLocale = c_pszLocale; - sys_log(0, "AsyncSQL: locale %s", m_stLocale.c_str()); + SPDLOG_DEBUG("AsyncSQL: locale {}", m_stLocale); } if (!bNoThread) @@ -250,7 +250,7 @@ SQLMsg * CAsyncSQL::DirectQuery(const char * c_pszQuery) { if (m_ulThreadID != mysql_thread_id(&m_hDB)) { - sys_err("MySQL connection was reconnected. querying locale set"); + SPDLOG_WARN("MySQL connection was reconnected. querying locale set"); while (!QueryLocaleSet()); m_ulThreadID = mysql_thread_id(&m_hDB); } @@ -263,13 +263,7 @@ SQLMsg * CAsyncSQL::DirectQuery(const char * c_pszQuery) if (mysql_real_query(&m_hDB, p->stQuery.c_str(), p->stQuery.length())) { - char buf[1024]; - - snprintf(buf, sizeof(buf), - "AsyncSQL::DirectQuery : mysql_query error: %s\nquery: %s", - mysql_error(&m_hDB), p->stQuery.c_str()); - - sys_err(buf); + SPDLOG_ERROR("AsyncSQL::DirectQuery : mysql_query error: {}\nquery: {}", mysql_error(&m_hDB), p->stQuery); p->uiSQLErrno = mysql_errno(&m_hDB); } @@ -554,7 +548,7 @@ void CAsyncSQL::ChildLoop() if (m_ulThreadID != mysql_thread_id(&m_hDB)) { - sys_err("MySQL connection was reconnected. querying locale set"); + SPDLOG_WARN("MySQL connection was reconnected. querying locale set"); while (!QueryLocaleSet()); m_ulThreadID = mysql_thread_id(&m_hDB); } @@ -563,8 +557,8 @@ void CAsyncSQL::ChildLoop() { p->uiSQLErrno = mysql_errno(&m_hDB); - sys_err("AsyncSQL: query failed: %s (query: %s errno: %d)", - mysql_error(&m_hDB), p->stQuery.c_str(), p->uiSQLErrno); + SPDLOG_ERROR("AsyncSQL: query failed: {} (query: {} errno: {})", + mysql_error(&m_hDB), p->stQuery, p->uiSQLErrno); switch (p->uiSQLErrno) { @@ -584,7 +578,7 @@ void CAsyncSQL::ChildLoop() case ER_CANT_CREATE_THREAD: case ER_INVALID_USE_OF_NULL: m_sem.Release(); - sys_err("AsyncSQL: retrying"); + SPDLOG_WARN("AsyncSQL: retrying"); continue; } } @@ -593,8 +587,8 @@ void CAsyncSQL::ChildLoop() // 0.5ÃÊ ÀÌ»ó °É·ÈÀ¸¸é ·Î±×¿¡ ³²±â±â if (!profiler.IsOk()) - sys_log(0, "[QUERY : LONG INTERVAL(OverSec %ld.%ld)] : %s", - profiler.GetResultSec(), profiler.GetResultUSec(), p->stQuery.c_str()); + SPDLOG_TRACE("[QUERY : LONG INTERVAL(OverSec {}.{})] : {}", + profiler.GetResultSec(), profiler.GetResultUSec(), p->stQuery); PopQueryFromCopyQueue(); @@ -616,7 +610,7 @@ void CAsyncSQL::ChildLoop() { if (m_ulThreadID != mysql_thread_id(&m_hDB)) { - sys_err("MySQL connection was reconnected. querying locale set"); + SPDLOG_WARN("MySQL connection was reconnected. querying locale set"); while (!QueryLocaleSet()); m_ulThreadID = mysql_thread_id(&m_hDB); } @@ -625,8 +619,8 @@ void CAsyncSQL::ChildLoop() { p->uiSQLErrno = mysql_errno(&m_hDB); - sys_err("AsyncSQL::ChildLoop : mysql_query error: %s:\nquery: %s", - mysql_error(&m_hDB), p->stQuery.c_str()); + SPDLOG_ERROR("AsyncSQL::ChildLoop : mysql_query error: {}:\nquery: {}", + mysql_error(&m_hDB), p->stQuery); switch (p->uiSQLErrno) { @@ -649,7 +643,7 @@ void CAsyncSQL::ChildLoop() } } - sys_log(0, "QUERY_FLUSH: %s", p->stQuery.c_str()); + SPDLOG_TRACE("QUERY_FLUSH: {}", p->stQuery); PopQuery(p->iID); @@ -698,7 +692,7 @@ size_t CAsyncSQL::EscapeString(char* dst, size_t dstSize, const char *src, size_ size_t tmpLen = sizeof(tmp) > srcSize ? srcSize : sizeof(tmp); // µÑ Áß¿¡ ÀÛÀº Å©±â strlcpy(tmp, src, tmpLen); - sys_err("FATAL ERROR!! not enough buffer size (dstSize %u srcSize %u src%s: %s)", + SPDLOG_CRITICAL("FATAL ERROR!! not enough buffer size (dstSize {} srcSize {} src{}: {})", dstSize, srcSize, tmpLen != srcSize ? "(trimmed to 255 characters)" : "", tmp); dst[0] = '\0'; diff --git a/src/libsql/src/CStatement.cpp b/src/libsql/src/CStatement.cpp index 2bb5348..4f666ed 100644 --- a/src/libsql/src/CStatement.cpp +++ b/src/libsql/src/CStatement.cpp @@ -34,7 +34,7 @@ void CStmt::Destroy() void CStmt::Error(const char * c_pszMsg) { - sys_log(0, "SYSERR: %s: [%d] %s", c_pszMsg, mysql_stmt_errno(m_pkStmt), mysql_stmt_error(m_pkStmt)); + SPDLOG_ERROR("SYSERR: {}: [{}] {}", c_pszMsg, mysql_stmt_errno(m_pkStmt), mysql_stmt_error(m_pkStmt)); } bool CStmt::Prepare(CAsyncSQL * sql, const char * c_pszQuery) @@ -78,7 +78,7 @@ bool CStmt::BindParam(enum_field_types type, void * p, int iMaxLen) { if (m_uiParamCount >= m_vec_param.size()) { - sys_err("too many parameter in query: %s", m_stQuery.c_str()); + SPDLOG_ERROR("too many parameter in query: {}", m_stQuery); return false; } @@ -105,7 +105,7 @@ bool CStmt::BindResult(enum_field_types type, void * p, int iMaxLen) { if (m_uiResultCount >= m_vec_result.size()) { - sys_err("too many result in query: %s", m_stQuery.c_str()); + SPDLOG_ERROR("too many result in query: {}", m_stQuery); return false; } @@ -121,7 +121,7 @@ int CStmt::Execute() { if (m_uiParamCount != m_vec_param.size()) { - sys_log(0, "Parameter not enough %d, expected %d query: %s", m_uiParamCount, m_vec_param.size(), m_stQuery.c_str()); + SPDLOG_ERROR("Parameter not enough {}, expected {} query: {}", m_uiParamCount, m_vec_param.size(), m_stQuery); return 0; } @@ -132,7 +132,7 @@ int CStmt::Execute() if (bind->buffer_type == MYSQL_TYPE_STRING) { *(m_puiParamLen + i) = strlen((const char *) bind->buffer); - sys_log(0, "param %d len %d buf %s", i, *m_puiParamLen, (const char *) bind->buffer); + SPDLOG_TRACE("param {} len {} buf {}", i, *m_puiParamLen, (const char *) bind->buffer); } } diff --git a/src/libthecore/CMakeLists.txt b/src/libthecore/CMakeLists.txt index 7ac98e8..8a95011 100644 --- a/src/libthecore/CMakeLists.txt +++ b/src/libthecore/CMakeLists.txt @@ -18,3 +18,11 @@ add_library(${PROJECT_NAME} STATIC ${SOURCES}) find_package(Boost REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} PRIVATE ${Boost_LIBRARIES}) + +# fmt +find_package(fmt CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt) + +# spdlog +find_package(spdlog CONFIG REQUIRED) +target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog) diff --git a/src/libthecore/include/log.h b/src/libthecore/include/log.h index e759144..16cb696 100644 --- a/src/libthecore/include/log.h +++ b/src/libthecore/include/log.h @@ -1,39 +1,12 @@ -#ifndef __INC_LIBTHECORE_LOG_H__ -#define __INC_LIBTHECORE_LOG_H__ +#pragma once -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - extern int log_init(void); - extern void log_destroy(void); - extern void log_rotate(void); +extern int log_init(void); +extern void log_destroy(void); - // ·Î±× ·¹º§ ó¸® (·¹º§Àº bitvector·Î 󸮵ȴÙ) - extern void log_set_level(unsigned int level); - extern void log_unset_level(unsigned int level); +// ·Î±× ·¹º§ ó¸® (·¹º§Àº bitvector·Î 󸮵ȴÙ) +extern void log_set_level(unsigned int level); +extern void log_unset_level(unsigned int level); - // ·Î±× ÆÄÀÏÀ» ¾ó¸¸Å­ º¸°üÇϴ°¡¿¡ ´ëÇÑ ÇÔ¼ö - extern void log_set_expiration_days(unsigned int days); - extern int log_get_expiration_days(void); - -#ifndef __WIN32__ - extern void _sys_err(const char *func, int line, const char *format, ...); -#else - extern void _sys_err(const char *func, int line, const char *format, ...); -#endif - extern void sys_log_header(const char *header); - extern void sys_log(unsigned int lv, const char *format, ...); - extern void pt_log(const char *format, ...); - -#ifndef __WIN32__ -#define sys_err(fmt, args...) _sys_err(__FUNCTION__, __LINE__, fmt, ##args) -#else -#define sys_err(fmt, ...) _sys_err(__FUNCTION__, __LINE__, fmt, __VA_ARGS__) -#endif // __WIN32__ - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // __INC_LOG_H__ +// ·Î±× ÆÄÀÏÀ» ¾ó¸¸Å­ º¸°üÇϴ°¡¿¡ ´ëÇÑ ÇÔ¼ö +extern void log_set_expiration_days(unsigned int days); +extern int log_get_expiration_days(void); diff --git a/src/libthecore/include/stdafx.h b/src/libthecore/include/stdafx.h index fee89a7..3146ad9 100644 --- a/src/libthecore/include/stdafx.h +++ b/src/libthecore/include/stdafx.h @@ -28,6 +28,9 @@ #include +#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE +#include + #include #include diff --git a/src/libthecore/include/utils.h b/src/libthecore/include/utils.h index b1ec6ec..c560f38 100644 --- a/src/libthecore/include/utils.h +++ b/src/libthecore/include/utils.h @@ -42,7 +42,7 @@ using Random = effolkronium::random_static; #define CREATE(result, type, number) do { \ if (!((result) = (type *) calloc ((number), sizeof(type)))) { \ - sys_err("calloc failed [%d] %s", errno, strerror(errno)); \ + SPDLOG_CRITICAL("calloc failed [{}] {}", errno, strerror(errno)); \ abort(); } } while(0) #define RECREATE(result,type,number) do { \ diff --git a/src/libthecore/src/buffer.cpp b/src/libthecore/src/buffer.cpp index 7f71ce3..ba38d11 100644 --- a/src/libthecore/src/buffer.cpp +++ b/src/libthecore/src/buffer.cpp @@ -71,7 +71,7 @@ bool safe_create(char** pdata, int number) { if (!((*pdata) = (char *) calloc (number, sizeof(char)))) { - sys_err("calloc failed [%d] %s", errno, strerror(errno)); + SPDLOG_ERROR("calloc failed [{}] {}", errno, strerror(errno)); return false; } else @@ -111,7 +111,7 @@ LPBUFFER buffer_new(int size) // ½ÇÆÐÇϸé ÃÖÈÄÀÇ ¼ö´ÜÀ¸·Î, ¸ðµç poolÀ» ÇØÁ¦ÇÑ´Ù. buffer_pool_free(); CREATE(buffer->mem_data, char, size); - sys_err ("buffer pool free success."); + SPDLOG_ERROR("buffer pool free success."); } } assert(buffer != NULL); @@ -206,10 +206,10 @@ void buffer_read_proceed(LPBUFFER buffer, int length) return; if (length < 0) - sys_err("buffer_proceed: length argument lower than zero (length: %d)", length); + SPDLOG_ERROR("buffer_proceed: length argument lower than zero (length: {})", length); else if (length > buffer->length) { - sys_err("buffer_proceed: length argument bigger than buffer (length: %d, buffer: %d)", length, buffer->length); + SPDLOG_ERROR("buffer_proceed: length argument bigger than buffer (length: {}, buffer: {})", length, buffer->length); length = buffer->length; } @@ -219,7 +219,7 @@ void buffer_read_proceed(LPBUFFER buffer, int length) // write_point ¿Í pos ´Â ±×´ë·Î µÎ°í read_point ¸¸ Áõ°¡ ½ÃŲ´Ù. if (buffer->read_point + length - buffer->mem_data > buffer->mem_size) { - sys_err("buffer_read_proceed: buffer overflow! length %d read_point %d", length, buffer->read_point - buffer->mem_data); + SPDLOG_ERROR("buffer_read_proceed: buffer overflow! length {} read_point {}", length, buffer->read_point - buffer->mem_data); abort(); } @@ -254,7 +254,7 @@ void buffer_adjust_size(LPBUFFER& buffer, int add_size) if (buffer->mem_size >= buffer->write_point_pos + add_size) return; - sys_log(0, "buffer_adjust %d current %d/%d", add_size, buffer->length, buffer->mem_size); + SPDLOG_TRACE("buffer_adjust {} current {}/{}", add_size, buffer->length, buffer->mem_size); buffer_realloc(buffer, buffer->mem_size + add_size); } @@ -276,7 +276,7 @@ void buffer_realloc(LPBUFFER& buffer, int length) return; temp = buffer_new (length); - sys_log(0, "reallocating buffer to %d, current %d", temp->mem_size, buffer->mem_size); + SPDLOG_TRACE("reallocating buffer to {}, current {}", temp->mem_size, buffer->mem_size); memcpy(temp->mem_data, buffer->mem_data, buffer->mem_size); read_point_pos = buffer->read_point - buffer->mem_data; diff --git a/src/libthecore/src/heart.cpp b/src/libthecore/src/heart.cpp index b6b5a87..649c3d9 100644 --- a/src/libthecore/src/heart.cpp +++ b/src/libthecore/src/heart.cpp @@ -15,8 +15,8 @@ LPHEART heart_new(int opt_usec, HEARTFUNC func) if (!func) { - sys_err("no function defined"); - return NULL; + SPDLOG_ERROR("no function defined"); + return NULL; } CREATE(ht, HEART, 1); @@ -80,14 +80,14 @@ int heart_idle(LPHEART ht) if (missed_pulse <= 0) { - sys_err("missed_pulse is not positive! (%d)", missed_pulse); - missed_pulse = 1; + SPDLOG_ERROR("missed_pulse is not positive! ({})", missed_pulse); + missed_pulse = 1; } if (missed_pulse > (30 * ht->passes_per_sec)) { - sys_err("losing %d seconds. (lag occured)", missed_pulse / ht->passes_per_sec); - missed_pulse = 30 * ht->passes_per_sec; + SPDLOG_ERROR("losing {} seconds. (lag occured)", missed_pulse / ht->passes_per_sec); + missed_pulse = 30 * ht->passes_per_sec; } return missed_pulse; diff --git a/src/libthecore/src/log.cpp b/src/libthecore/src/log.cpp index 2ecde97..b9591f5 100644 --- a/src/libthecore/src/log.cpp +++ b/src/libthecore/src/log.cpp @@ -1,57 +1,19 @@ -/* - * Filename: log.c - * Description: local log file °ü·Ã - * - * Author: ºñ¿± aka. Cronan - */ #define __LIBTHECORE__ #include "stdafx.h" +#include "spdlog/sinks/stdout_color_sinks.h" -#ifndef __WIN32__ -#define SYSLOG_FILENAME "syslog" -#define SYSERR_FILENAME "syserr" -#define PTS_FILENAME "PTS" -#else #define SYSLOG_FILENAME "syslog.txt" #define SYSERR_FILENAME "syserr.txt" -#define PTS_FILENAME "PTS.txt" -#endif -typedef struct log_file_s * LPLOGFILE; -typedef struct log_file_s LOGFILE; - -struct log_file_s -{ - char* filename; - FILE* fp; - - int last_hour; - int last_day; -}; - -LPLOGFILE log_file_sys = NULL; -LPLOGFILE log_file_err = NULL; -LPLOGFILE log_file_pt = NULL; -static char log_dir[32] = { 0, }; unsigned int log_keep_days = 3; -// Internal functions -LPLOGFILE log_file_init(const char* filename, const char *openmode); -void log_file_destroy(LPLOGFILE logfile); -void log_file_rotate(LPLOGFILE logfile); -void log_file_check(LPLOGFILE logfile); -void log_file_set_dir(const char *dir); - -static unsigned int log_level_bits = 7; void log_set_level(unsigned int bit) { - log_level_bits |= bit; } void log_unset_level(unsigned int bit) { - log_level_bits &= ~bit; } void log_set_expiration_days(unsigned int days) @@ -66,404 +28,12 @@ int log_get_expiration_days(void) int log_init(void) { - log_file_set_dir("./log"); + //spdlog::set_level(spdlog::level::debug); - do - { - log_file_sys = log_file_init(SYSLOG_FILENAME, "a+"); - if( NULL == log_file_sys ) break; - - log_file_err = log_file_init(SYSERR_FILENAME, "a+"); - if( NULL == log_file_err ) break; - - log_file_pt = log_file_init(PTS_FILENAME, "w"); - if( NULL == log_file_pt ) break; - - return true; - } - while( false ); - - return false; + return 1; } void log_destroy(void) { - log_file_destroy(log_file_sys); - log_file_destroy(log_file_err); - log_file_destroy(log_file_pt); - log_file_sys = NULL; - log_file_err = NULL; - log_file_pt = NULL; -} - -void log_rotate(void) -{ - log_file_check(log_file_sys); - log_file_check(log_file_err); - log_file_check(log_file_pt); - - log_file_rotate(log_file_sys); -} - -#ifndef __WIN32__ -void _sys_err(const char *func, int line, const char *format, ...) -{ - va_list args; - time_t ct = time(0); - char *time_s = asctime(localtime(&ct)); - - struct timeval tv; - int nMiliSec = 0; - gettimeofday(&tv, NULL); - - - - char buf[1024 + 2]; // \nÀ» ºÙÀ̱â À§ÇØ.. - int len; - - if (!log_file_err) - return; - - time_s[strlen(time_s) - 1] = '\0'; - len = snprintf(buf, 1024, "SYSERR: %-15.15s.%ld :: %s: ", time_s + 4, tv.tv_usec, func); - buf[1025] = '\0'; - - if (len < 1024) - { - va_start(args, format); - vsnprintf(buf + len, 1024 - len, format, args); - va_end(args); - } - - strcat(buf, "\n"); - - // log_file_err ¿¡ Ãâ·Â - fputs(buf, log_file_err->fp); - fflush(log_file_err->fp); - - // log_file_sys ¿¡µµ Ãâ·Â - fputs(buf, log_file_sys->fp); - fflush(log_file_sys->fp); -} -#else -void _sys_err(const char *func, int line, const char *format, ...) -{ - va_list args; - time_t ct = time(0); - char *time_s = asctime(localtime(&ct)); - - char buf[1024 + 2]; // \nÀ» ºÙÀ̱â À§ÇØ.. - int len; - - if (!log_file_err) - return; - - time_s[strlen(time_s) - 1] = '\0'; - len = snprintf(buf, 1024, "SYSERR: %-15.15s :: %s: ", time_s + 4, func); - buf[1025] = '\0'; - - if (len < 1024) - { - va_start(args, format); - vsnprintf(buf + len, 1024 - len, format, args); - va_end(args); - } - - strcat(buf, "\n"); - - // log_file_err ¿¡ Ãâ·Â - fputs(buf, log_file_err->fp); - fflush(log_file_err->fp); - - // log_file_sys ¿¡µµ Ãâ·Â - fputs(buf, log_file_sys->fp); - fflush(log_file_sys->fp); - - fputs(buf, stdout); - fflush(stdout); -} -#endif - -static char sys_log_header_string[33] = ""; - -void sys_log_header(const char *header) -{ - strncpy(sys_log_header_string, header, 32); -} - -void sys_log(unsigned int bit, const char *format, ...) -{ - va_list args; - - struct timeval tv; - int nMiliSec = 0; - gettimeofday(&tv, NULL); - - if (bit != 0 && !(log_level_bits & bit)) - return; - - if (log_file_sys) - { - time_t ct = time(0); - char *time_s = asctime(localtime(&ct)); - - fprintf(log_file_sys->fp, sys_log_header_string); - - time_s[strlen(time_s) - 1] = '\0'; - fprintf(log_file_sys->fp, "%-15.15s.%ld :: ", time_s + 4, tv.tv_usec ); - - va_start(args, format); - vfprintf(log_file_sys->fp, format, args); - va_end(args); - - fputc('\n', log_file_sys->fp); - fflush(log_file_sys->fp); - } - -#ifndef __WIN32__ - // log_levelÀÌ 1 ÀÌ»óÀÏ °æ¿ì¿¡´Â Å×½ºÆ®ÀÏ °æ¿ì°¡ ¸¹À¸´Ï stdout¿¡µµ Ãâ·ÂÇÑ´Ù. - if (log_level_bits > 1) - { -#endif - fprintf(stdout, sys_log_header_string); - - va_start(args, format); - vfprintf(stdout, format, args); - va_end(args); - - fputc('\n', stdout); - fflush(stdout); -#ifndef __WIN32__ - } -#endif -} - -void pt_log(const char *format, ...) -{ - va_list args; - - if (!log_file_pt) - return; - - va_start(args, format); - vfprintf(log_file_pt->fp, format, args); - va_end(args); - - fputc('\n', log_file_pt->fp); - fflush(log_file_pt->fp); -} - -LPLOGFILE log_file_init(const char * filename, const char * openmode) -{ - LPLOGFILE logfile; - FILE * fp; - struct tm curr_tm; - time_t time_s; - - time_s = time(0); - curr_tm = *localtime(&time_s); - - fp = fopen(filename, openmode); - - if (!fp) - return NULL; - - logfile = (LPLOGFILE) malloc(sizeof(LOGFILE)); - logfile->filename = strdup(filename); - logfile->fp = fp; - logfile->last_hour = curr_tm.tm_hour; - logfile->last_day = curr_tm.tm_mday; - - return (logfile); -} - -void log_file_destroy(LPLOGFILE logfile) -{ - if (logfile == NULL) { - return; - } - - if (logfile->filename) - { - free(logfile->filename); - logfile->filename = NULL; - } - - if (logfile->fp) - { - fclose(logfile->fp); - logfile->fp = NULL; - } - - free(logfile); -} - -void log_file_check(LPLOGFILE logfile) -{ - struct stat sb; - - // ÆÄÀÏÀÌ ¾øÀ¸¹Ç·Î ´Ù½Ã ¿¬´Ù. - if (stat(logfile->filename, &sb) != 0 && errno == ENOENT) - { - fclose(logfile->fp); - logfile->fp = fopen(logfile->filename, "a+"); - } -} - -void log_file_delete_old(const char *filename) -{ - struct stat sb; - int num1, num2; - char buf[32]; - char system_cmd[512]; - struct tm new_tm; - - if (stat(filename, &sb) == -1) - { - perror("log_file_delete_old: stat"); - return; - } - - if (!S_ISDIR(sb.st_mode)) - return; - - new_tm = *tm_calc(NULL, -log_keep_days); - sprintf(buf, "%04d%02d%02d", new_tm.tm_year + 1900, new_tm.tm_mon + 1, new_tm.tm_mday); - num1 = atoi(buf); -#ifndef __WIN32__ - { - struct dirent ** namelist; - int n; - - n = scandir(filename, &namelist, 0, alphasort); - - if (n < 0) - perror("scandir"); - else - { - char name[MAXNAMLEN+1]; - - while (n-- > 0) - { - strncpy(name, namelist[n]->d_name, 255); - name[255] = '\0'; - - free(namelist[n]); - - if (*name == '.') - continue; - - if (!isdigit(*name)) - continue; - - num2 = atoi(name); - - if (num2 <= num1) - { - snprintf(system_cmd, sizeof(system_cmd), "rm -rf %s/%s", filename, name); - system(system_cmd); - - sys_log(0, "%s: SYSTEM_CMD: %s", __FUNCTION__, system_cmd); - fprintf(stderr, "%s: SYSTEM_CMD: %s %s:%d %s:%d\n", __FUNCTION__, system_cmd, buf, num1, name, num2); - } - } - } - - free(namelist); - } -#else - { - WIN32_FIND_DATA fdata; - HANDLE hFind; - if ((hFind = FindFirstFile(filename, &fdata)) != INVALID_HANDLE_VALUE) - { - do - { - if (!isdigit(*fdata.cFileName)) - continue; - - num2 = atoi(fdata.cFileName); - - if (num2 <= num1) - { - sprintf(system_cmd, "del %s\\%s", filename, fdata.cFileName); - system(system_cmd); - - sys_log(0, "SYSTEM_CMD: %s", system_cmd); - } - } - while (FindNextFile(hFind, &fdata)); - } - } -#endif -} - -void log_file_rotate(LPLOGFILE logfile) -{ - struct tm curr_tm; - time_t time_s; - char dir[256]; - char system_cmd[512]; - - time_s = time(0); - curr_tm = *localtime(&time_s); - - if (curr_tm.tm_mday != logfile->last_day) - { - struct tm new_tm; - new_tm = *tm_calc(&curr_tm, -3); - -#ifndef __WIN32__ - sprintf(system_cmd, "rm -rf %s/%04d%02d%02d", log_dir, new_tm.tm_year + 1900, new_tm.tm_mon + 1, new_tm.tm_mday); -#else - sprintf(system_cmd, "del %s\\%04d%02d%02d", log_dir, new_tm.tm_year + 1900, new_tm.tm_mon + 1, new_tm.tm_mday); -#endif - system(system_cmd); - - sys_log(0, "SYSTEM_CMD: %s", system_cmd); - - logfile->last_day = curr_tm.tm_mday; - } - - if (curr_tm.tm_hour != logfile->last_hour) - { - struct stat stat_buf; - snprintf(dir, sizeof(dir), "%s/%04d%02d%02d", log_dir, curr_tm.tm_year + 1900, curr_tm.tm_mon + 1, curr_tm.tm_mday); - - if (stat(dir, &stat_buf) != 0 || S_ISDIR(stat_buf.st_mode)) - { -#ifdef __WIN32__ - CreateDirectory(dir, NULL); -#else - mkdir(dir, S_IRWXU); -#endif - } - - sys_log(0, "SYSTEM: LOG ROTATE (%04d-%02d-%02d %d)", - curr_tm.tm_year + 1900, curr_tm.tm_mon + 1, curr_tm.tm_mday, logfile->last_hour); - - // ·Î±× ÆÄÀÏÀ» ´Ý°í - fclose(logfile->fp); - - // ¿Å±ä´Ù. -#ifndef __WIN32__ - snprintf(system_cmd, sizeof(system_cmd), "mv %s %s/%s.%02d", logfile->filename, dir, logfile->filename, logfile->last_hour); -#else - snprintf(system_cmd, sizeof(system_cmd), "move %s %s\\%s.%02d", logfile->filename, dir, logfile->filename, logfile->last_hour); -#endif - system(system_cmd); - - // ¸¶Áö¸· ÀúÀå½Ã°£ ÀúÀå - logfile->last_hour = curr_tm.tm_hour; - - // ·Î±× ÆÄÀÏÀ» ´Ù½Ã ¿¬´Ù. - logfile->fp = fopen(logfile->filename, "a+"); - } -} - -void log_file_set_dir(const char *dir) -{ - strcpy(log_dir, dir); - log_file_delete_old(log_dir); } diff --git a/src/libthecore/src/main.cpp b/src/libthecore/src/main.cpp index dcac751..2c2aa3a 100644 --- a/src/libthecore/src/main.cpp +++ b/src/libthecore/src/main.cpp @@ -24,12 +24,11 @@ static int pid_init(void) { fprintf(fp, "%d", getpid()); fclose(fp); - sys_err("\nStart of pid: %d\n", getpid()); + SPDLOG_INFO("Start of pid: {}", getpid()); } else { - printf("pid_init(): could not open file for writing. (filename: ./pid)"); - sys_err("\nError writing pid file\n"); + SPDLOG_ERROR("pid_init(): could not open file for writing. (filename: ./pid)"); return false; } return true; @@ -42,7 +41,7 @@ static void pid_deinit(void) return; #else remove("./pid"); - sys_err("\nEnd of pid\n"); + SPDLOG_INFO("End of pid"); #endif } diff --git a/src/libthecore/src/utils.cpp b/src/libthecore/src/utils.cpp index 083f344..f3a23cb 100644 --- a/src/libthecore/src/utils.cpp +++ b/src/libthecore/src/utils.cpp @@ -215,11 +215,11 @@ void thecore_sleep(struct timeval* timeout) { if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0) { - if (errno != EINTR) - { - sys_err("select sleep %s", strerror(errno)); - return; - } + if (errno != EINTR) + { + SPDLOG_ERROR("select sleep {}", strerror(errno)); + return; + } } } @@ -232,8 +232,8 @@ void thecore_msleep(DWORD dwMillisecond) } void core_dump_unix(const char *who, WORD line) -{ - sys_err("*** Dumping Core %s:%d ***", who, line); +{ + SPDLOG_CRITICAL("*** Dumping Core {}:{} ***", who, line); fflush(stdout); fflush(stderr);