diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index db424846d..901c21464 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char **argv) { Log(Logs::General, Logs::Status, "Client Files Export Utility"); if(!EQEmuConfig::LoadConfig()) { - Log(Logs::General, Logs::Error, "Unable to load configuration file."); + LogError("Unable to load configuration file"); return 1; } @@ -51,8 +51,7 @@ int main(int argc, char **argv) { Log(Logs::General, Logs::Status, "Connecting to database..."); if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " - "database connection"); + LogError("Unable to connect to the database, cannot continue without a database connection"); return 1; } @@ -98,7 +97,7 @@ void ExportSpells(SharedDatabase *db) { FILE *f = fopen("export/spells_us.txt", "w"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping."); + LogError("Unable to open export/spells_us.txt to write, skipping."); return; } @@ -169,7 +168,7 @@ void ExportSkillCaps(SharedDatabase *db) { FILE *f = fopen("export/SkillCaps.txt", "w"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping."); + LogError("Unable to open export/SkillCaps.txt to write, skipping."); return; } @@ -198,7 +197,7 @@ void ExportBaseData(SharedDatabase *db) { FILE *f = fopen("export/BaseData.txt", "w"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping."); + LogError("Unable to open export/BaseData.txt to write, skipping."); return; } @@ -229,7 +228,7 @@ void ExportDBStrings(SharedDatabase *db) { FILE *f = fopen("export/dbstr_us.txt", "w"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping."); + LogError("Unable to open export/dbstr_us.txt to write, skipping."); return; } diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index a8e2ad0fe..e52c53cd4 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) { Log(Logs::General, Logs::Status, "Client Files Import Utility"); if(!EQEmuConfig::LoadConfig()) { - Log(Logs::General, Logs::Error, "Unable to load configuration file."); + LogError("Unable to load configuration file."); return 1; } @@ -49,7 +49,7 @@ int main(int argc, char **argv) { Log(Logs::General, Logs::Status, "Connecting to database..."); if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " + LogError("Unable to connect to the database, cannot continue without a " "database connection"); return 1; } @@ -100,7 +100,7 @@ void ImportSpells(SharedDatabase *db) { Log(Logs::General, Logs::Status, "Importing Spells..."); FILE *f = fopen("import/spells_us.txt", "r"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping."); + LogError("Unable to open import/spells_us.txt to read, skipping."); return; } @@ -189,7 +189,7 @@ void ImportSkillCaps(SharedDatabase *db) { FILE *f = fopen("import/SkillCaps.txt", "r"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping."); + LogError("Unable to open import/SkillCaps.txt to read, skipping."); return; } @@ -224,7 +224,7 @@ void ImportBaseData(SharedDatabase *db) { FILE *f = fopen("import/BaseData.txt", "r"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping."); + LogError("Unable to open import/BaseData.txt to read, skipping."); return; } @@ -269,7 +269,7 @@ void ImportDBStrings(SharedDatabase *db) { FILE *f = fopen("import/dbstr_us.txt", "r"); if(!f) { - Log(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping."); + LogError("Unable to open import/dbstr_us.txt to read, skipping."); return; } diff --git a/common/database.cpp b/common/database.cpp index 9ff0baf0f..de72769a3 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -64,7 +64,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c uint32 errnum= 0; char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); + LogError("Failed to connect to database: Error: {}", errbuf); return false; } else { @@ -327,7 +327,7 @@ bool Database::DeleteCharacter(char *name) { auto results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); } if (charid <= 0){ - Log(Logs::General, Logs::Error, "Database::DeleteCharacter :: Character (%s) not found, stopping delete...", name); + LogError("Database::DeleteCharacter :: Character ({}) not found, stopping delete...", name); return false; } @@ -714,7 +714,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu charid = GetCharacterID(pp->name); if(!charid) { - Log(Logs::General, Logs::Error, "StoreCharacter: no character id"); + LogError("StoreCharacter: no character id"); return false; } @@ -1551,7 +1551,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism auto results = QueryDatabase(query); if (!results.Success()) - Log(Logs::General, Logs::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str()); + LogError("Error deleting character from group id: {}", results.ErrorMessage().c_str()); return; } diff --git a/common/inventory_profile.cpp b/common/inventory_profile.cpp index 826c84fb4..a51b04998 100644 --- a/common/inventory_profile.cpp +++ b/common/inventory_profile.cpp @@ -1381,7 +1381,7 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst) } if (result == INVALID_INDEX) { - Log(Logs::General, Logs::Error, "InventoryProfile::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot); + LogError("InventoryProfile::_PutItem: Invalid slot_id specified ({}) with parent slot id ({})", slot_id, parentSlot); InventoryProfile::MarkDirty(inst); // Slot not found, clean up } diff --git a/common/opcodemgr.cpp b/common/opcodemgr.cpp index 2190db4a7..11d1b4811 100644 --- a/common/opcodemgr.cpp +++ b/common/opcodemgr.cpp @@ -32,7 +32,7 @@ OpcodeManager::OpcodeManager() { bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors) { FILE *opf = fopen(filename, "r"); if(opf == nullptr) { - Log(Logs::General, Logs::Error, "Unable to open opcodes file '%s'", filename); + LogError("Unable to open opcodes file [{}]", filename); return(false); } diff --git a/common/ptimer.cpp b/common/ptimer.cpp index 5a3d9617f..032ac5945 100644 --- a/common/ptimer.cpp +++ b/common/ptimer.cpp @@ -134,7 +134,6 @@ bool PersistentTimer::Load(Database *db) { (unsigned long)_char_id, _type); auto results = db->QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); return false; } @@ -165,9 +164,6 @@ bool PersistentTimer::Store(Database *db) { #endif auto results = db->QueryDatabase(query); if (!results.Success()) { -#if EQDEBUG > 5 - Log(Logs::General, Logs::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str()); -#endif return false; } @@ -185,9 +181,6 @@ bool PersistentTimer::Clear(Database *db) { auto results = db->QueryDatabase(query); if (!results.Success()) { -#if EQDEBUG > 5 - Log(Logs::General, Logs::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); -#endif return false; } @@ -198,7 +191,7 @@ bool PersistentTimer::Clear(Database *db) { /* This function checks if the timer triggered */ bool PersistentTimer::Expired(Database *db, bool iReset) { if (this == nullptr) { - Log(Logs::General, Logs::Error, "Null timer during ->Check()!?\n"); + LogError("Null timer during ->Check()!?\n"); return(true); } uint32 current_time = get_current_time(); @@ -289,9 +282,6 @@ bool PTimerList::Load(Database *db) { (unsigned long)_char_id); auto results = db->QueryDatabase(query); if (!results.Success()) { -#if EQDEBUG > 5 - Log(Logs::General, Logs::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str()); -#endif return false; } @@ -348,9 +338,6 @@ bool PTimerList::Clear(Database *db) { #endif auto results = db->QueryDatabase(query); if (!results.Success()) { -#if EQDEBUG > 5 - Log(Logs::General, Logs::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str()); -#endif return false; } @@ -440,9 +427,6 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) { #endif auto results = db->QueryDatabase(query); if (!results.Success()) { -#if EQDEBUG > 5 - Log(Logs::General, Logs::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str()); -#endif return false; } diff --git a/common/say_link.cpp b/common/say_link.cpp index 4b8ddc009..f4937fe88 100644 --- a/common/say_link.cpp +++ b/common/say_link.cpp @@ -100,8 +100,8 @@ const std::string &EQEmu::SayLinkEngine::GenerateLink() if ((m_Link.length() == 0) || (m_Link.length() > (EQEmu::constants::SAY_LINK_MAXIMUM_SIZE))) { m_Error = true; m_Link = ""; - Log(Logs::General, Logs::Error, "SayLinkEngine::GenerateLink() failed to generate a useable say link"); - Log(Logs::General, Logs::Error, ">> LinkType: %i, Lengths: {link: %u(%u), body: %u(%u), text: %u(%u)}", + LogError("SayLinkEngine::GenerateLink() failed to generate a useable say link"); + LogError(">> LinkType: {}, Lengths: {link: {}({}), body: {}({}), text: {}({})}", m_LinkType, m_Link.length(), EQEmu::constants::SAY_LINK_MAXIMUM_SIZE, @@ -110,8 +110,8 @@ const std::string &EQEmu::SayLinkEngine::GenerateLink() m_LinkText.length(), EQEmu::constants::SAY_LINK_TEXT_SIZE ); - Log(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str()); - Log(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str()); + LogError(">> LinkBody: {}", m_LinkBody.c_str()); + LogError(">> LinkText: {}", m_LinkText.c_str()); } return m_Link; @@ -316,7 +316,7 @@ std::string EQEmu::SayLinkEngine::GenerateQuestSaylink(std::string saylink_text, results = database.QueryDatabase(insert_query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "Error in saylink phrase queries %s", results.ErrorMessage().c_str()); + LogError("Error in saylink phrase queries {}", results.ErrorMessage().c_str()); } else { saylink_id = results.LastInsertedID(); diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 97585670c..a854318ac 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -123,7 +123,7 @@ void SharedDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) MailKeyString, CharID); auto results = QueryDatabase(query); if (!results.Success()) - Log(Logs::General, Logs::Error, "SharedDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str()); + LogError("SharedDatabase::SetMailKey({}, {}) : {}", CharID, MailKeyString, results.ErrorMessage().c_str()); } @@ -466,8 +466,6 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool id); auto results = QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "Database::GetSharedBank(uint32 account_id): %s", - results.ErrorMessage().c_str()); return false; } @@ -561,7 +559,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) char_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the " + LogError("If you got an error related to the 'instnodrop' field, run the " "following SQL Queries:\nalter table inventory add instnodrop " "tinyint(1) unsigned default 0 not null;\n"); return false; @@ -699,8 +697,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) put_slot_id = inv->PushCursor(*inst); } else if (slot_id >= 3111 && slot_id <= 3179) { // Admins: please report any occurrences of this error - Log(Logs::General, Logs::Error, "Warning: Defunct location for item in inventory: " - "charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", + LogError("Warning: Defunct location for item in inventory: charid={}, item_id={}, slot_id={} .. pushing to cursor...", char_id, item_id, slot_id); put_slot_id = inv->PushCursor(*inst); } else { @@ -746,7 +743,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::Inventor name, account_id); auto results = QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "If you got an error related to the 'instnodrop' field, run the " + LogError("If you got an error related to the 'instnodrop' field, run the " "following SQL Queries:\nalter table inventory add instnodrop " "tinyint(1) unsigned default 0 not null;\n"); return false; @@ -834,8 +831,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::Inventor // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) - Log(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: name=%s, " - "acctid=%i, item_id=%i, slot_id=%i", + LogError("Warning: Invalid slot_id for item in inventory: name={}, acctid={}, item_id={}, slot_id={}", name, account_id, item_id, slot_id); } @@ -911,7 +907,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) { items_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), items_mmf->Size())); mutex.Unlock(); } catch(std::exception& ex) { - Log(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what()); + LogError("Error Loading Items: {}", ex.what()); return false; } @@ -1172,7 +1168,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_ try { hash.insert(item.ID, item); } catch (std::exception &ex) { - Log(Logs::General, Logs::Error, "Database::LoadItems: %s", ex.what()); + LogError("Database::LoadItems: {}", ex.what()); break; } } @@ -1229,7 +1225,7 @@ std::string SharedDatabase::GetBook(const char *txtfile, int16 *language) } if (results.RowCount() == 0) { - Log(Logs::General, Logs::Error, "No book to send, (%s)", txtfile); + LogError("No book to send, ({})", txtfile); txtout.assign(" ",1); return txtout; } @@ -1334,7 +1330,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) { faction_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), faction_mmf->Size())); mutex.Unlock(); } catch(std::exception& ex) { - Log(Logs::General, Logs::Error, "Error Loading npc factions: %s", ex.what()); + LogError("Error Loading npc factions: {}", ex.what()); return false; } @@ -1352,8 +1348,8 @@ EQEmu::ItemInstance* SharedDatabase::CreateItem(uint32 item_id, int16 charges, u inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); - Log(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + LogError("Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); + LogError("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges); return nullptr; } @@ -1378,8 +1374,8 @@ EQEmu::ItemInstance* SharedDatabase::CreateItem(const EQEmu::ItemData* item, int inst = CreateBaseItem(item, charges); if (inst == nullptr) { - Log(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); - Log(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + LogError("Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); + LogError("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges); return nullptr; } @@ -1409,8 +1405,8 @@ EQEmu::ItemInstance* SharedDatabase::CreateBaseItem(const EQEmu::ItemData* item, inst = new EQEmu::ItemInstance(item, charges); if (inst == nullptr) { - Log(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateBaseItem()"); - Log(Logs::General, Logs::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges); + LogError("Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateBaseItem()"); + LogError("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges); return nullptr; } @@ -1485,7 +1481,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) { skill_caps_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name)); mutex.Unlock(); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "Error loading skill caps: %s", ex.what()); + LogError("Error loading skill caps: {}", ex.what()); return false; } @@ -1501,7 +1497,7 @@ void SharedDatabase::LoadSkillCaps(void *data) { const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level"; auto results = QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str()); + LogError("Error loading skill caps from database: {}", results.ErrorMessage().c_str()); return; } @@ -1645,7 +1641,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const mutex.Unlock(); } catch(std::exception& ex) { - Log(Logs::General, Logs::Error, "Error Loading Spells: %s", ex.what()); + LogError("Error Loading Spells: {}", ex.what()); return false; } return true; @@ -1849,7 +1845,7 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) { base_data_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name)); mutex.Unlock(); } catch(std::exception& ex) { - Log(Logs::General, Logs::Error, "Error Loading Base Data: %s", ex.what()); + LogError("Error Loading Base Data: {}", ex.what()); return false; } @@ -1873,22 +1869,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) { cl = atoi(row[1]); if(lvl <= 0) { - Log(Logs::General, Logs::Error, "Non fatal error: base_data.level <= 0, ignoring."); + LogError("Non fatal error: base_data.level <= 0, ignoring."); continue; } if(lvl >= max_level) { - Log(Logs::General, Logs::Error, "Non fatal error: base_data.level >= max_level, ignoring."); + LogError("Non fatal error: base_data.level >= max_level, ignoring."); continue; } if(cl <= 0) { - Log(Logs::General, Logs::Error, "Non fatal error: base_data.cl <= 0, ignoring."); + LogError("Non fatal error: base_data.cl <= 0, ignoring."); continue; } if(cl > 16) { - Log(Logs::General, Logs::Error, "Non fatal error: base_data.class > 16, ignoring."); + LogError("Non fatal error: base_data.class > 16, ignoring."); continue; } @@ -2096,7 +2092,7 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) { loot_drop_mmf->Size())); mutex.Unlock(); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "Error loading loot: %s", ex.what()); + LogError("Error loading loot: {}", ex.what()); return false; } @@ -2112,7 +2108,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) { return &loot_table_hash->at(loottable_id); } } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "Could not get loot table: %s", ex.what()); + LogError("Could not get loot table: {}", ex.what()); } return nullptr; } @@ -2126,7 +2122,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) { return &loot_drop_hash->at(lootdrop_id); } } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "Could not get loot drop: %s", ex.what()); + LogError("Could not get loot drop: {}", ex.what()); } return nullptr; } diff --git a/queryserv/database.cpp b/queryserv/database.cpp index 592931f95..25fb5996e 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -69,7 +69,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); + LogError("Failed to connect to database: Error: {}", errbuf); HandleMysqlError(errnum); return false; diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp index 63280adc0..45787a2b3 100644 --- a/shared_memory/main.cpp +++ b/shared_memory/main.cpp @@ -76,7 +76,7 @@ int main(int argc, char **argv) { Log(Logs::General, Logs::Status, "Shared Memory Loader Program"); if(!EQEmuConfig::LoadConfig()) { - Log(Logs::General, Logs::Error, "Unable to load configuration file."); + LogError("Unable to load configuration file"); return 1; } @@ -86,8 +86,7 @@ int main(int argc, char **argv) { Log(Logs::General, Logs::Status, "Connecting to database..."); if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { - Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a " - "database connection"); + LogError("Unable to connect to the database, cannot continue without a database connection"); return 1; } @@ -185,7 +184,7 @@ int main(int argc, char **argv) { try { LoadItems(&database, hotfix_name); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "%s", ex.what()); + LogError("{}", ex.what()); return 1; } } @@ -195,7 +194,7 @@ int main(int argc, char **argv) { try { LoadFactions(&database, hotfix_name); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "%s", ex.what()); + LogError("{}", ex.what()); return 1; } } @@ -205,7 +204,7 @@ int main(int argc, char **argv) { try { LoadLoot(&database, hotfix_name); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "%s", ex.what()); + LogError("{}", ex.what()); return 1; } } @@ -215,7 +214,7 @@ int main(int argc, char **argv) { try { LoadSkillCaps(&database, hotfix_name); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "%s", ex.what()); + LogError("{}", ex.what()); return 1; } } @@ -225,7 +224,7 @@ int main(int argc, char **argv) { try { LoadSpells(&database, hotfix_name); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "%s", ex.what()); + LogError("{}", ex.what()); return 1; } } @@ -235,7 +234,7 @@ int main(int argc, char **argv) { try { LoadBaseData(&database, hotfix_name); } catch(std::exception &ex) { - Log(Logs::General, Logs::Error, "%s", ex.what()); + LogError("{}", ex.what()); return 1; } } diff --git a/ucs/database.cpp b/ucs/database.cpp index 497d669cb..051bae211 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -74,7 +74,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c char errbuf[MYSQL_ERRMSG_SIZE]; if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { - Log(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf); + LogError("Failed to connect to database: Error: {}", errbuf); HandleMysqlError(errnum); return false; diff --git a/world/eql_config.cpp b/world/eql_config.cpp index 1a1536591..9c065acb5 100644 --- a/world/eql_config.cpp +++ b/world/eql_config.cpp @@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() { std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + LogError("EQLConfig::LoadSettings: {}", results.ErrorMessage().c_str()); } else { auto row = results.begin(); @@ -52,7 +52,7 @@ void EQLConfig::LoadSettings() { query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); + LogError("EQLConfig::LoadSettings: {}", results.ErrorMessage().c_str()); return; } @@ -199,7 +199,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log(Logs::General, Logs::Error, "Update for unknown zone %s", short_name); + LogError("Update for unknown zone {}", short_name); return false; } @@ -235,7 +235,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) { res = m_zones.find(short_name); if(res == m_zones.end()) { //not found. - Log(Logs::General, Logs::Error, "Update for unknown zone %s", short_name); + LogError("Update for unknown zone {}", short_name); return false; } diff --git a/world/net.cpp b/world/net.cpp index 6b6190a9e..fb495fa8e 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -311,7 +311,7 @@ int main(int argc, char** argv) { std::string hotfix_name; if (database.GetVariable("hotfix_name", hotfix_name)) { if (!hotfix_name.empty()) { - Log(Logs::General, Logs::ZoneServer, "Current hotfix in use: '%s'", hotfix_name.c_str()); + LogInfo("Current hotfix in use: '%s'", hotfix_name.c_str()); } } diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 47354cc60..41b3c853d 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -512,7 +512,7 @@ void WorldDatabase::GetLauncherList(std::vector &rl) { const std::string query = "SELECT name FROM launcher"; auto results = QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); + LogError("WorldDatabase::GetLauncherList: {}", results.ErrorMessage().c_str()); return; } @@ -526,7 +526,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level) std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name); auto results = QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); + LogError("WorldDatabase::GetCharacterLevel: {}", results.ErrorMessage().c_str()); return false; } diff --git a/zone/aa.cpp b/zone/aa.cpp index 1712dd7a0..425fe6457 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -57,7 +57,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u PetRecord record; if (!database.GetPoweredPetEntry(spells[spell_id].teleport_zone, act_power, &record)) { - Log(Logs::General, Logs::Error, "Unknown swarm pet spell id: %d, check pets table", spell_id); + LogError("Unknown swarm pet spell id: {}, check pets table", spell_id); Message(Chat::Red, "Unable to find data for pet %s", spells[spell_id].teleport_zone); return; } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 6592acaed..7ebe002c5 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -559,7 +559,7 @@ bool Client::Process() { if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) { OnDisconnect(true); - Log(Logs::General, Logs::ZoneServer, "Client linkdead: %s", name); + LogInfo("Client linkdead: {}", name); if (Admin() > 100) { if (GetMerc()) { diff --git a/zone/command.cpp b/zone/command.cpp index 0b4f406d1..e8689ffb2 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -5819,7 +5819,7 @@ void command_time(Client *c, const Seperator *sep) } c->Message(Chat::Red, "Setting world time to %s:%i (Timezone: 0)...", sep->arg[1], minutes); zone->SetTime(atoi(sep->arg[1])+1, minutes); - Log(Logs::General, Logs::ZoneServer, "%s :: Setting world time to %s:%i (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes); + LogInfo("{} :: Setting world time to {}:{} (Timezone: 0)...", c->GetCleanName(), sep->arg[1], minutes); } else { c->Message(Chat::Red, "To set the Time: #time HH [MM]"); @@ -5834,7 +5834,7 @@ void command_time(Client *c, const Seperator *sep) zone->zone_time.getEQTimeZoneMin() ); c->Message(Chat::Red, "It is now %s.", timeMessage); - Log(Logs::General, Logs::ZoneServer, "Current Time is: %s", timeMessage); + LogInfo("Current Time is: {}", timeMessage); } } diff --git a/zone/net.cpp b/zone/net.cpp index 6b2aa74bb..c6b4635bf 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -145,7 +145,7 @@ int main(int argc, char** argv) { QServ = new QueryServ; - Log(Logs::General, Logs::ZoneServer, "Loading server configuration.."); + LogInfo("Loading server configuration.."); if (!ZoneConfig::LoadConfig()) { Log(Logs::General, Logs::Error, "Loading server configuration failed."); return 1; @@ -225,7 +225,7 @@ int main(int argc, char** argv) { worldserver.SetLauncherName("NONE"); } - Log(Logs::General, Logs::ZoneServer, "Connecting to MySQL... "); + LogInfo("Connecting to MySQL... "); if (!database.Connect( Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), @@ -255,7 +255,7 @@ int main(int argc, char** argv) { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif - Log(Logs::General, Logs::ZoneServer, "CURRENT_VERSION: %s", CURRENT_VERSION); + LogInfo("CURRENT_VERSION: {}", CURRENT_VERSION); /* * Setup nice signal handlers @@ -275,102 +275,102 @@ int main(int argc, char** argv) { } #endif - Log(Logs::General, Logs::ZoneServer, "Mapping Incoming Opcodes"); + LogInfo("Mapping Incoming Opcodes"); MapOpcodes(); - Log(Logs::General, Logs::ZoneServer, "Loading Variables"); + LogInfo("Loading Variables"); database.LoadVariables(); std::string hotfix_name; if (database.GetVariable("hotfix_name", hotfix_name)) { if (!hotfix_name.empty()) { - Log(Logs::General, Logs::ZoneServer, "Current hotfix in use: '%s'", hotfix_name.c_str()); + LogInfo("Current hotfix in use: [{}]", hotfix_name.c_str()); } } - Log(Logs::General, Logs::ZoneServer, "Loading zone names"); + LogInfo("Loading zone names"); database.LoadZoneNames(); - Log(Logs::General, Logs::ZoneServer, "Loading items"); + LogInfo("Loading items"); if (!database.LoadItems(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading items FAILED!"); Log(Logs::General, Logs::Error, "Failed. But ignoring error and going on..."); } - Log(Logs::General, Logs::ZoneServer, "Loading npc faction lists"); + LogInfo("Loading npc faction lists"); if (!database.LoadNPCFactionLists(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); return 1; } - Log(Logs::General, Logs::ZoneServer, "Loading loot tables"); + LogInfo("Loading loot tables"); if (!database.LoadLoot(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading loot FAILED!"); return 1; } - Log(Logs::General, Logs::ZoneServer, "Loading skill caps"); + LogInfo("Loading skill caps"); if (!database.LoadSkillCaps(std::string(hotfix_name))) { Log(Logs::General, Logs::Error, "Loading skill caps FAILED!"); return 1; } - Log(Logs::General, Logs::ZoneServer, "Loading spells"); + LogInfo("Loading spells"); if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) { Log(Logs::General, Logs::Error, "Loading spells FAILED!"); return 1; } - Log(Logs::General, Logs::ZoneServer, "Loading base data"); + LogInfo("Loading base data"); if (!database.LoadBaseData(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading base data FAILED!"); return 1; } - Log(Logs::General, Logs::ZoneServer, "Loading guilds"); + LogInfo("Loading guilds"); guild_mgr.LoadGuilds(); - Log(Logs::General, Logs::ZoneServer, "Loading factions"); + LogInfo("Loading factions"); database.LoadFactionData(); - Log(Logs::General, Logs::ZoneServer, "Loading titles"); + LogInfo("Loading titles"); title_manager.LoadTitles(); - Log(Logs::General, Logs::ZoneServer, "Loading tributes"); + LogInfo("Loading tributes"); database.LoadTributes(); - Log(Logs::General, Logs::ZoneServer, "Loading corpse timers"); + LogInfo("Loading corpse timers"); database.GetDecayTimes(npcCorpseDecayTimes); - Log(Logs::General, Logs::ZoneServer, "Loading profanity list"); + LogInfo("Loading profanity list"); if (!EQEmu::ProfanityManager::LoadProfanityList(&database)) Log(Logs::General, Logs::Error, "Loading profanity list FAILED!"); - Log(Logs::General, Logs::ZoneServer, "Loading commands"); + LogInfo("Loading commands"); int retval = command_init(); if (retval<0) Log(Logs::General, Logs::Error, "Command loading FAILED"); else - Log(Logs::General, Logs::ZoneServer, "%d commands loaded", retval); + LogInfo("{} commands loaded", retval); //rules: { std::string tmp; if (database.GetVariable("RuleSet", tmp)) { - Log(Logs::General, Logs::ZoneServer, "Loading rule set '%s'", tmp.c_str()); + LogInfo("Loading rule set [{}]", tmp.c_str()); if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) { Log(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str()); } } else { if (!RuleManager::Instance()->LoadRules(&database, "default", false)) { - Log(Logs::General, Logs::ZoneServer, "No rule set configured, using default rules"); + LogInfo("No rule set configured, using default rules"); } else { - Log(Logs::General, Logs::ZoneServer, "Loaded default rule set 'default'", tmp.c_str()); + LogInfo("Loaded default rule set 'default'"); } } EQEmu::InitializeDynamicLookups(); - Log(Logs::General, Logs::ZoneServer, "Initialized dynamic dictionary entries"); + LogInfo("Initialized dynamic dictionary entries"); } #ifdef BOTS @@ -407,7 +407,7 @@ int main(int argc, char** argv) { #endif //now we have our parser, load the quests - Log(Logs::General, Logs::ZoneServer, "Loading quests"); + LogInfo("Loading quests"); parse->ReloadQuests(); worldserver.Connect(); @@ -420,7 +420,7 @@ int main(int argc, char** argv) { #endif #endif if (!strlen(zone_name) || !strcmp(zone_name, ".")) { - Log(Logs::General, Logs::ZoneServer, "Entering sleep mode"); + LogInfo("Entering sleep mode"); } else if (!Zone::Bootup(database.GetZoneID(zone_name), instance_id, true)) { Log(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup"); @@ -478,7 +478,7 @@ int main(int argc, char** argv) { * EQStreamManager */ if (!eqsf_open && Config->ZonePort != 0) { - Log(Logs::General, Logs::ZoneServer, "Starting EQ Network server on port %d", Config->ZonePort); + LogInfo("Starting EQ Network server on port {}", Config->ZonePort); EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream)); opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS); @@ -607,7 +607,7 @@ int main(int argc, char** argv) { bot_command_deinit(); #endif safe_delete(parse); - Log(Logs::General, Logs::ZoneServer, "Proper zone shutdown complete."); + LogInfo("Proper zone shutdown complete."); LogSys.CloseFileLogs(); return 0; } @@ -623,7 +623,7 @@ void Shutdown() { Zone::Shutdown(true); RunLoops = false; - Log(Logs::General, Logs::ZoneServer, "Shutting down..."); + LogInfo("Shutting down..."); LogSys.CloseFileLogs(); } diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index e719c84f7..c3d38ce4f 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -1050,7 +1050,7 @@ int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings* perl_event_export_settings) { - Log(Logs::General, Logs::ZoneServer, "Loading Perl Event Export Settings..."); + LogInfo("Loading Perl Event Export Settings..."); /* Write Defaults First (All Enabled) */ for (int i = 0; i < _LargestEventID; i++){ diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 0f9846c72..e6c3a8665 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -816,12 +816,12 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) (eq_time.hour >= 13) ? "pm" : "am" ); - Log(Logs::General, Logs::ZoneServer, "Time Broadcast Packet: %s", time_message); + LogInfo("Time Broadcast Packet: {}", time_message); zone->SetZoneHasCurrentTime(true); } if (zone && zone->is_zone_time_localized) { - Log(Logs::General, Logs::ZoneServer, "Received request to sync time from world, but our time is localized currently"); + LogInfo("Received request to sync time from world, but our time is localized currently"); } break; } @@ -1942,32 +1942,32 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) case ServerOP_ChangeSharedMem: { std::string hotfix_name = std::string((char*)pack->pBuffer); - Log(Logs::General, Logs::ZoneServer, "Loading items"); + LogInfo("Loading items"); if (!database.LoadItems(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading items FAILED!"); } - Log(Logs::General, Logs::ZoneServer, "Loading npc faction lists"); + LogInfo("Loading npc faction lists"); if (!database.LoadNPCFactionLists(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); } - Log(Logs::General, Logs::ZoneServer, "Loading loot tables"); + LogInfo("Loading loot tables"); if (!database.LoadLoot(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading loot FAILED!"); } - Log(Logs::General, Logs::ZoneServer, "Loading skill caps"); + LogInfo("Loading skill caps"); if (!database.LoadSkillCaps(std::string(hotfix_name))) { Log(Logs::General, Logs::Error, "Loading skill caps FAILED!"); } - Log(Logs::General, Logs::ZoneServer, "Loading spells"); + LogInfo("Loading spells"); if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) { Log(Logs::General, Logs::Error, "Loading spells FAILED!"); } - Log(Logs::General, Logs::ZoneServer, "Loading base data"); + LogInfo("Loading base data"); if (!database.LoadBaseData(hotfix_name)) { Log(Logs::General, Logs::Error, "Loading base data FAILED!"); } diff --git a/zone/zone.cpp b/zone/zone.cpp index fbe763450..16b15aa20 100755 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1459,7 +1459,7 @@ void Zone::StartShutdownTimer(uint32 set_time) { set_time = static_cast(database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion())); } autoshutdown_timer.SetTimer(set_time); - Log(Logs::General, Logs::ZoneServer, "Zone::StartShutdownTimer set to %u", set_time); + LogInfo("Zone::StartShutdownTimer set to {}", set_time); } Log(Logs::Detail, Logs::ZoneServer, @@ -1606,7 +1606,7 @@ void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/) /* By Default we update worlds time, but we can optionally no update world which updates the rest of the zone servers */ if (update_world){ - Log(Logs::General, Logs::ZoneServer, "Setting master time on world server to: %d:%d (%d)\n", hour, minute, (int)eq_time_of_day->start_realtime); + LogInfo("Setting master time on world server to: {}:{} ({})\n", hour, minute, (int)eq_time_of_day->start_realtime); worldserver.SendPacket(pack); /* Set Time Localization Flag */ @@ -1615,7 +1615,7 @@ void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/) /* When we don't update world, we are localizing ourselves, we become disjointed from normal syncs and set time locally */ else{ - Log(Logs::General, Logs::ZoneServer, "Setting zone localized time..."); + LogInfo("Setting zone localized time..."); zone->zone_time.SetCurrentEQTimeOfDay(eq_time_of_day->start_eqtime, eq_time_of_day->start_realtime); auto outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));