Simplify log calls

This commit is contained in:
Akkadius 2019-09-01 21:04:58 -05:00
parent d3803045bc
commit 98cbb7d781
21 changed files with 113 additions and 135 deletions

View File

@ -41,7 +41,7 @@ int main(int argc, char **argv) {
Log(Logs::General, Logs::Status, "Client Files Export Utility"); Log(Logs::General, Logs::Status, "Client Files Export Utility");
if(!EQEmuConfig::LoadConfig()) { if(!EQEmuConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Unable to load configuration file."); LogError("Unable to load configuration file");
return 1; return 1;
} }
@ -51,8 +51,7 @@ int main(int argc, char **argv) {
Log(Logs::General, Logs::Status, "Connecting to database..."); Log(Logs::General, Logs::Status, "Connecting to database...");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { 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");
"database connection");
return 1; return 1;
} }
@ -98,7 +97,7 @@ void ExportSpells(SharedDatabase *db) {
FILE *f = fopen("export/spells_us.txt", "w"); FILE *f = fopen("export/spells_us.txt", "w");
if(!f) { 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; return;
} }
@ -169,7 +168,7 @@ void ExportSkillCaps(SharedDatabase *db) {
FILE *f = fopen("export/SkillCaps.txt", "w"); FILE *f = fopen("export/SkillCaps.txt", "w");
if(!f) { 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; return;
} }
@ -198,7 +197,7 @@ void ExportBaseData(SharedDatabase *db) {
FILE *f = fopen("export/BaseData.txt", "w"); FILE *f = fopen("export/BaseData.txt", "w");
if(!f) { 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; return;
} }
@ -229,7 +228,7 @@ void ExportDBStrings(SharedDatabase *db) {
FILE *f = fopen("export/dbstr_us.txt", "w"); FILE *f = fopen("export/dbstr_us.txt", "w");
if(!f) { 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; return;
} }

View File

@ -39,7 +39,7 @@ int main(int argc, char **argv) {
Log(Logs::General, Logs::Status, "Client Files Import Utility"); Log(Logs::General, Logs::Status, "Client Files Import Utility");
if(!EQEmuConfig::LoadConfig()) { if(!EQEmuConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Unable to load configuration file."); LogError("Unable to load configuration file.");
return 1; return 1;
} }
@ -49,7 +49,7 @@ int main(int argc, char **argv) {
Log(Logs::General, Logs::Status, "Connecting to database..."); Log(Logs::General, Logs::Status, "Connecting to database...");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { 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"); "database connection");
return 1; return 1;
} }
@ -100,7 +100,7 @@ void ImportSpells(SharedDatabase *db) {
Log(Logs::General, Logs::Status, "Importing Spells..."); Log(Logs::General, Logs::Status, "Importing Spells...");
FILE *f = fopen("import/spells_us.txt", "r"); FILE *f = fopen("import/spells_us.txt", "r");
if(!f) { 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; return;
} }
@ -189,7 +189,7 @@ void ImportSkillCaps(SharedDatabase *db) {
FILE *f = fopen("import/SkillCaps.txt", "r"); FILE *f = fopen("import/SkillCaps.txt", "r");
if(!f) { 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; return;
} }
@ -224,7 +224,7 @@ void ImportBaseData(SharedDatabase *db) {
FILE *f = fopen("import/BaseData.txt", "r"); FILE *f = fopen("import/BaseData.txt", "r");
if(!f) { 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; return;
} }
@ -269,7 +269,7 @@ void ImportDBStrings(SharedDatabase *db) {
FILE *f = fopen("import/dbstr_us.txt", "r"); FILE *f = fopen("import/dbstr_us.txt", "r");
if(!f) { 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; return;
} }

View File

@ -64,7 +64,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
uint32 errnum= 0; uint32 errnum= 0;
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) { 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; return false;
} }
else { else {
@ -327,7 +327,7 @@ bool Database::DeleteCharacter(char *name) {
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); } for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); }
if (charid <= 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; return false;
} }
@ -714,7 +714,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu
charid = GetCharacterID(pp->name); charid = GetCharacterID(pp->name);
if(!charid) { if(!charid) {
Log(Logs::General, Logs::Error, "StoreCharacter: no character id"); LogError("StoreCharacter: no character id");
return false; return false;
} }
@ -1551,7 +1551,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) 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; return;
} }

View File

@ -1381,7 +1381,7 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
} }
if (result == INVALID_INDEX) { 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 InventoryProfile::MarkDirty(inst); // Slot not found, clean up
} }

View File

@ -32,7 +32,7 @@ OpcodeManager::OpcodeManager() {
bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors) { bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors) {
FILE *opf = fopen(filename, "r"); FILE *opf = fopen(filename, "r");
if(opf == nullptr) { if(opf == nullptr) {
Log(Logs::General, Logs::Error, "Unable to open opcodes file '%s'", filename); LogError("Unable to open opcodes file [{}]", filename);
return(false); return(false);
} }

View File

@ -134,7 +134,6 @@ bool PersistentTimer::Load(Database *db) {
(unsigned long)_char_id, _type); (unsigned long)_char_id, _type);
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
return false; return false;
} }
@ -165,9 +164,6 @@ bool PersistentTimer::Store(Database *db) {
#endif #endif
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
#if EQDEBUG > 5
Log(Logs::General, Logs::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str());
#endif
return false; return false;
} }
@ -185,9 +181,6 @@ bool PersistentTimer::Clear(Database *db) {
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
#if EQDEBUG > 5
Log(Logs::General, Logs::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
#endif
return false; return false;
} }
@ -198,7 +191,7 @@ bool PersistentTimer::Clear(Database *db) {
/* This function checks if the timer triggered */ /* This function checks if the timer triggered */
bool PersistentTimer::Expired(Database *db, bool iReset) { bool PersistentTimer::Expired(Database *db, bool iReset) {
if (this == nullptr) { if (this == nullptr) {
Log(Logs::General, Logs::Error, "Null timer during ->Check()!?\n"); LogError("Null timer during ->Check()!?\n");
return(true); return(true);
} }
uint32 current_time = get_current_time(); uint32 current_time = get_current_time();
@ -289,9 +282,6 @@ bool PTimerList::Load(Database *db) {
(unsigned long)_char_id); (unsigned long)_char_id);
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
#if EQDEBUG > 5
Log(Logs::General, Logs::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
#endif
return false; return false;
} }
@ -348,9 +338,6 @@ bool PTimerList::Clear(Database *db) {
#endif #endif
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
#if EQDEBUG > 5
Log(Logs::General, Logs::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
#endif
return false; return false;
} }
@ -440,9 +427,6 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) {
#endif #endif
auto results = db->QueryDatabase(query); auto results = db->QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
#if EQDEBUG > 5
Log(Logs::General, Logs::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str());
#endif
return false; return false;
} }

View File

@ -100,8 +100,8 @@ const std::string &EQEmu::SayLinkEngine::GenerateLink()
if ((m_Link.length() == 0) || (m_Link.length() > (EQEmu::constants::SAY_LINK_MAXIMUM_SIZE))) { if ((m_Link.length() == 0) || (m_Link.length() > (EQEmu::constants::SAY_LINK_MAXIMUM_SIZE))) {
m_Error = true; m_Error = true;
m_Link = "<LINKER ERROR>"; m_Link = "<LINKER ERROR>";
Log(Logs::General, Logs::Error, "SayLinkEngine::GenerateLink() failed to generate a useable say link"); LogError("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(">> LinkType: {}, Lengths: {link: {}({}), body: {}({}), text: {}({})}",
m_LinkType, m_LinkType,
m_Link.length(), m_Link.length(),
EQEmu::constants::SAY_LINK_MAXIMUM_SIZE, EQEmu::constants::SAY_LINK_MAXIMUM_SIZE,
@ -110,8 +110,8 @@ const std::string &EQEmu::SayLinkEngine::GenerateLink()
m_LinkText.length(), m_LinkText.length(),
EQEmu::constants::SAY_LINK_TEXT_SIZE EQEmu::constants::SAY_LINK_TEXT_SIZE
); );
Log(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str()); LogError(">> LinkBody: {}", m_LinkBody.c_str());
Log(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str()); LogError(">> LinkText: {}", m_LinkText.c_str());
} }
return m_Link; return m_Link;
@ -316,7 +316,7 @@ std::string EQEmu::SayLinkEngine::GenerateQuestSaylink(std::string saylink_text,
results = database.QueryDatabase(insert_query); results = database.QueryDatabase(insert_query);
if (!results.Success()) { 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 { else {
saylink_id = results.LastInsertedID(); saylink_id = results.LastInsertedID();

View File

@ -123,7 +123,7 @@ void SharedDatabase::SetMailKey(int CharID, int IPAddress, int MailKey)
MailKeyString, CharID); MailKeyString, CharID);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) 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); id);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Error, "Database::GetSharedBank(uint32 account_id): %s",
results.ErrorMessage().c_str());
return false; return false;
} }
@ -561,7 +559,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
char_id); char_id);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { 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 " "following SQL Queries:\nalter table inventory add instnodrop "
"tinyint(1) unsigned default 0 not null;\n"); "tinyint(1) unsigned default 0 not null;\n");
return false; return false;
@ -699,8 +697,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv)
put_slot_id = inv->PushCursor(*inst); put_slot_id = inv->PushCursor(*inst);
} else if (slot_id >= 3111 && slot_id <= 3179) { } else if (slot_id >= 3111 && slot_id <= 3179) {
// Admins: please report any occurrences of this error // Admins: please report any occurrences of this error
Log(Logs::General, Logs::Error, "Warning: Defunct location for item in inventory: " LogError("Warning: Defunct location for item in inventory: charid={}, item_id={}, slot_id={} .. pushing to cursor...",
"charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...",
char_id, item_id, slot_id); char_id, item_id, slot_id);
put_slot_id = inv->PushCursor(*inst); put_slot_id = inv->PushCursor(*inst);
} else { } else {
@ -746,7 +743,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::Inventor
name, account_id); name, account_id);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { 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 " "following SQL Queries:\nalter table inventory add instnodrop "
"tinyint(1) unsigned default 0 not null;\n"); "tinyint(1) unsigned default 0 not null;\n");
return false; return false;
@ -834,8 +831,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQEmu::Inventor
// Save ptr to item in inventory // Save ptr to item in inventory
if (put_slot_id == INVALID_INDEX) if (put_slot_id == INVALID_INDEX)
Log(Logs::General, Logs::Error, "Warning: Invalid slot_id for item in inventory: name=%s, " LogError("Warning: Invalid slot_id for item in inventory: name={}, acctid={}, item_id={}, slot_id={}",
"acctid=%i, item_id=%i, slot_id=%i",
name, account_id, 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<EQEmu::FixedMemoryHashSet<EQEmu::ItemData>>(new EQEmu::FixedMemoryHashSet<EQEmu::ItemData>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size())); items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::ItemData>>(new EQEmu::FixedMemoryHashSet<EQEmu::ItemData>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
mutex.Unlock(); mutex.Unlock();
} catch(std::exception& ex) { } catch(std::exception& ex) {
Log(Logs::General, Logs::Error, "Error Loading Items: %s", ex.what()); LogError("Error Loading Items: {}", ex.what());
return false; return false;
} }
@ -1172,7 +1168,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
try { try {
hash.insert(item.ID, item); hash.insert(item.ID, item);
} catch (std::exception &ex) { } catch (std::exception &ex) {
Log(Logs::General, Logs::Error, "Database::LoadItems: %s", ex.what()); LogError("Database::LoadItems: {}", ex.what());
break; break;
} }
} }
@ -1229,7 +1225,7 @@ std::string SharedDatabase::GetBook(const char *txtfile, int16 *language)
} }
if (results.RowCount() == 0) { if (results.RowCount() == 0) {
Log(Logs::General, Logs::Error, "No book to send, (%s)", txtfile); LogError("No book to send, ({})", txtfile);
txtout.assign(" ",1); txtout.assign(" ",1);
return txtout; return txtout;
} }
@ -1334,7 +1330,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
faction_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<NPCFactionList>>(new EQEmu::FixedMemoryHashSet<NPCFactionList>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size())); faction_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<NPCFactionList>>(new EQEmu::FixedMemoryHashSet<NPCFactionList>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size()));
mutex.Unlock(); mutex.Unlock();
} catch(std::exception& ex) { } 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; return false;
} }
@ -1352,8 +1348,8 @@ EQEmu::ItemInstance* SharedDatabase::CreateItem(uint32 item_id, int16 charges, u
inst = CreateBaseItem(item, charges); inst = CreateBaseItem(item, charges);
if (inst == nullptr) { if (inst == nullptr) {
Log(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); LogError("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("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges);
return nullptr; return nullptr;
} }
@ -1378,8 +1374,8 @@ EQEmu::ItemInstance* SharedDatabase::CreateItem(const EQEmu::ItemData* item, int
inst = CreateBaseItem(item, charges); inst = CreateBaseItem(item, charges);
if (inst == nullptr) { if (inst == nullptr) {
Log(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateItem()"); LogError("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("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges);
return nullptr; return nullptr;
} }
@ -1409,8 +1405,8 @@ EQEmu::ItemInstance* SharedDatabase::CreateBaseItem(const EQEmu::ItemData* item,
inst = new EQEmu::ItemInstance(item, charges); inst = new EQEmu::ItemInstance(item, charges);
if (inst == nullptr) { if (inst == nullptr) {
Log(Logs::General, Logs::Error, "Error: valid item data returned a null reference for EQEmu::ItemInstance creation in SharedDatabase::CreateBaseItem()"); LogError("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("Item Data = ID: {}, Name: {}, Charges: {}", item->ID, item->Name, charges);
return nullptr; return nullptr;
} }
@ -1485,7 +1481,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
skill_caps_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name)); skill_caps_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
mutex.Unlock(); mutex.Unlock();
} catch(std::exception &ex) { } 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; 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"; const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level";
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { 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; return;
} }
@ -1645,7 +1641,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
mutex.Unlock(); mutex.Unlock();
} }
catch(std::exception& ex) { catch(std::exception& ex) {
Log(Logs::General, Logs::Error, "Error Loading Spells: %s", ex.what()); LogError("Error Loading Spells: {}", ex.what());
return false; return false;
} }
return true; return true;
@ -1849,7 +1845,7 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) {
base_data_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name)); base_data_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
mutex.Unlock(); mutex.Unlock();
} catch(std::exception& ex) { } 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; return false;
} }
@ -1873,22 +1869,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) {
cl = atoi(row[1]); cl = atoi(row[1]);
if(lvl <= 0) { 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; continue;
} }
if(lvl >= max_level) { 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; continue;
} }
if(cl <= 0) { 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; continue;
} }
if(cl > 16) { 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; continue;
} }
@ -2096,7 +2092,7 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) {
loot_drop_mmf->Size())); loot_drop_mmf->Size()));
mutex.Unlock(); mutex.Unlock();
} catch(std::exception &ex) { } catch(std::exception &ex) {
Log(Logs::General, Logs::Error, "Error loading loot: %s", ex.what()); LogError("Error loading loot: {}", ex.what());
return false; return false;
} }
@ -2112,7 +2108,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) {
return &loot_table_hash->at(loottable_id); return &loot_table_hash->at(loottable_id);
} }
} catch(std::exception &ex) { } 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; return nullptr;
} }
@ -2126,7 +2122,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) {
return &loot_drop_hash->at(lootdrop_id); return &loot_drop_hash->at(lootdrop_id);
} }
} catch(std::exception &ex) { } 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; return nullptr;
} }

View File

@ -69,7 +69,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) 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); HandleMysqlError(errnum);
return false; return false;

View File

@ -76,7 +76,7 @@ int main(int argc, char **argv) {
Log(Logs::General, Logs::Status, "Shared Memory Loader Program"); Log(Logs::General, Logs::Status, "Shared Memory Loader Program");
if(!EQEmuConfig::LoadConfig()) { if(!EQEmuConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Unable to load configuration file."); LogError("Unable to load configuration file");
return 1; return 1;
} }
@ -86,8 +86,7 @@ int main(int argc, char **argv) {
Log(Logs::General, Logs::Status, "Connecting to database..."); Log(Logs::General, Logs::Status, "Connecting to database...");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(), if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) { 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");
"database connection");
return 1; return 1;
} }
@ -185,7 +184,7 @@ int main(int argc, char **argv) {
try { try {
LoadItems(&database, hotfix_name); LoadItems(&database, hotfix_name);
} catch(std::exception &ex) { } catch(std::exception &ex) {
Log(Logs::General, Logs::Error, "%s", ex.what()); LogError("{}", ex.what());
return 1; return 1;
} }
} }
@ -195,7 +194,7 @@ int main(int argc, char **argv) {
try { try {
LoadFactions(&database, hotfix_name); LoadFactions(&database, hotfix_name);
} catch(std::exception &ex) { } catch(std::exception &ex) {
Log(Logs::General, Logs::Error, "%s", ex.what()); LogError("{}", ex.what());
return 1; return 1;
} }
} }
@ -205,7 +204,7 @@ int main(int argc, char **argv) {
try { try {
LoadLoot(&database, hotfix_name); LoadLoot(&database, hotfix_name);
} catch(std::exception &ex) { } catch(std::exception &ex) {
Log(Logs::General, Logs::Error, "%s", ex.what()); LogError("{}", ex.what());
return 1; return 1;
} }
} }
@ -215,7 +214,7 @@ int main(int argc, char **argv) {
try { try {
LoadSkillCaps(&database, hotfix_name); LoadSkillCaps(&database, hotfix_name);
} catch(std::exception &ex) { } catch(std::exception &ex) {
Log(Logs::General, Logs::Error, "%s", ex.what()); LogError("{}", ex.what());
return 1; return 1;
} }
} }
@ -225,7 +224,7 @@ int main(int argc, char **argv) {
try { try {
LoadSpells(&database, hotfix_name); LoadSpells(&database, hotfix_name);
} catch(std::exception &ex) { } catch(std::exception &ex) {
Log(Logs::General, Logs::Error, "%s", ex.what()); LogError("{}", ex.what());
return 1; return 1;
} }
} }
@ -235,7 +234,7 @@ int main(int argc, char **argv) {
try { try {
LoadBaseData(&database, hotfix_name); LoadBaseData(&database, hotfix_name);
} catch(std::exception &ex) { } catch(std::exception &ex) {
Log(Logs::General, Logs::Error, "%s", ex.what()); LogError("{}", ex.what());
return 1; return 1;
} }
} }

View File

@ -74,7 +74,7 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
char errbuf[MYSQL_ERRMSG_SIZE]; char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) 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); HandleMysqlError(errnum);
return false; return false;

View File

@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() {
std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf); std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf);
auto results = database.QueryDatabase(query); auto results = database.QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); LogError("EQLConfig::LoadSettings: {}", results.ErrorMessage().c_str());
} }
else { else {
auto row = results.begin(); auto row = results.begin();
@ -52,7 +52,7 @@ void EQLConfig::LoadSettings() {
query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf); query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf);
results = database.QueryDatabase(query); results = database.QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str()); LogError("EQLConfig::LoadSettings: {}", results.ErrorMessage().c_str());
return; return;
} }
@ -199,7 +199,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
res = m_zones.find(short_name); res = m_zones.find(short_name);
if(res == m_zones.end()) { if(res == m_zones.end()) {
//not found. //not found.
Log(Logs::General, Logs::Error, "Update for unknown zone %s", short_name); LogError("Update for unknown zone {}", short_name);
return false; return false;
} }
@ -235,7 +235,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
res = m_zones.find(short_name); res = m_zones.find(short_name);
if(res == m_zones.end()) { if(res == m_zones.end()) {
//not found. //not found.
Log(Logs::General, Logs::Error, "Update for unknown zone %s", short_name); LogError("Update for unknown zone {}", short_name);
return false; return false;
} }

View File

@ -311,7 +311,7 @@ int main(int argc, char** argv) {
std::string hotfix_name; std::string hotfix_name;
if (database.GetVariable("hotfix_name", hotfix_name)) { if (database.GetVariable("hotfix_name", hotfix_name)) {
if (!hotfix_name.empty()) { 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());
} }
} }

View File

@ -512,7 +512,7 @@ void WorldDatabase::GetLauncherList(std::vector<std::string> &rl) {
const std::string query = "SELECT name FROM launcher"; const std::string query = "SELECT name FROM launcher";
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str()); LogError("WorldDatabase::GetLauncherList: {}", results.ErrorMessage().c_str());
return; 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); std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
if (!results.Success()) { if (!results.Success()) {
Log(Logs::General, Logs::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str()); LogError("WorldDatabase::GetCharacterLevel: {}", results.ErrorMessage().c_str());
return false; return false;
} }

View File

@ -57,7 +57,7 @@ void Mob::TemporaryPets(uint16 spell_id, Mob *targ, const char *name_override, u
PetRecord record; PetRecord record;
if (!database.GetPoweredPetEntry(spells[spell_id].teleport_zone, act_power, &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); Message(Chat::Red, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
return; return;
} }

View File

@ -559,7 +559,7 @@ bool Client::Process() {
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) { if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
OnDisconnect(true); OnDisconnect(true);
Log(Logs::General, Logs::ZoneServer, "Client linkdead: %s", name); LogInfo("Client linkdead: {}", name);
if (Admin() > 100) { if (Admin() > 100) {
if (GetMerc()) { if (GetMerc()) {

View File

@ -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); c->Message(Chat::Red, "Setting world time to %s:%i (Timezone: 0)...", sep->arg[1], minutes);
zone->SetTime(atoi(sep->arg[1])+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 { else {
c->Message(Chat::Red, "To set the Time: #time HH [MM]"); 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() zone->zone_time.getEQTimeZoneMin()
); );
c->Message(Chat::Red, "It is now %s.", timeMessage); c->Message(Chat::Red, "It is now %s.", timeMessage);
Log(Logs::General, Logs::ZoneServer, "Current Time is: %s", timeMessage); LogInfo("Current Time is: {}", timeMessage);
} }
} }

View File

@ -145,7 +145,7 @@ int main(int argc, char** argv) {
QServ = new QueryServ; QServ = new QueryServ;
Log(Logs::General, Logs::ZoneServer, "Loading server configuration.."); LogInfo("Loading server configuration..");
if (!ZoneConfig::LoadConfig()) { if (!ZoneConfig::LoadConfig()) {
Log(Logs::General, Logs::Error, "Loading server configuration failed."); Log(Logs::General, Logs::Error, "Loading server configuration failed.");
return 1; return 1;
@ -225,7 +225,7 @@ int main(int argc, char** argv) {
worldserver.SetLauncherName("NONE"); worldserver.SetLauncherName("NONE");
} }
Log(Logs::General, Logs::ZoneServer, "Connecting to MySQL... "); LogInfo("Connecting to MySQL... ");
if (!database.Connect( if (!database.Connect(
Config->DatabaseHost.c_str(), Config->DatabaseHost.c_str(),
Config->DatabaseUsername.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); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif #endif
Log(Logs::General, Logs::ZoneServer, "CURRENT_VERSION: %s", CURRENT_VERSION); LogInfo("CURRENT_VERSION: {}", CURRENT_VERSION);
/* /*
* Setup nice signal handlers * Setup nice signal handlers
@ -275,102 +275,102 @@ int main(int argc, char** argv) {
} }
#endif #endif
Log(Logs::General, Logs::ZoneServer, "Mapping Incoming Opcodes"); LogInfo("Mapping Incoming Opcodes");
MapOpcodes(); MapOpcodes();
Log(Logs::General, Logs::ZoneServer, "Loading Variables"); LogInfo("Loading Variables");
database.LoadVariables(); database.LoadVariables();
std::string hotfix_name; std::string hotfix_name;
if (database.GetVariable("hotfix_name", hotfix_name)) { if (database.GetVariable("hotfix_name", hotfix_name)) {
if (!hotfix_name.empty()) { 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(); database.LoadZoneNames();
Log(Logs::General, Logs::ZoneServer, "Loading items"); LogInfo("Loading items");
if (!database.LoadItems(hotfix_name)) { if (!database.LoadItems(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading items FAILED!"); Log(Logs::General, Logs::Error, "Loading items FAILED!");
Log(Logs::General, Logs::Error, "Failed. But ignoring error and going on..."); 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)) { if (!database.LoadNPCFactionLists(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!");
return 1; return 1;
} }
Log(Logs::General, Logs::ZoneServer, "Loading loot tables"); LogInfo("Loading loot tables");
if (!database.LoadLoot(hotfix_name)) { if (!database.LoadLoot(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading loot FAILED!"); Log(Logs::General, Logs::Error, "Loading loot FAILED!");
return 1; return 1;
} }
Log(Logs::General, Logs::ZoneServer, "Loading skill caps"); LogInfo("Loading skill caps");
if (!database.LoadSkillCaps(std::string(hotfix_name))) { if (!database.LoadSkillCaps(std::string(hotfix_name))) {
Log(Logs::General, Logs::Error, "Loading skill caps FAILED!"); Log(Logs::General, Logs::Error, "Loading skill caps FAILED!");
return 1; return 1;
} }
Log(Logs::General, Logs::ZoneServer, "Loading spells"); LogInfo("Loading spells");
if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) { if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
Log(Logs::General, Logs::Error, "Loading spells FAILED!"); Log(Logs::General, Logs::Error, "Loading spells FAILED!");
return 1; return 1;
} }
Log(Logs::General, Logs::ZoneServer, "Loading base data"); LogInfo("Loading base data");
if (!database.LoadBaseData(hotfix_name)) { if (!database.LoadBaseData(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading base data FAILED!"); Log(Logs::General, Logs::Error, "Loading base data FAILED!");
return 1; return 1;
} }
Log(Logs::General, Logs::ZoneServer, "Loading guilds"); LogInfo("Loading guilds");
guild_mgr.LoadGuilds(); guild_mgr.LoadGuilds();
Log(Logs::General, Logs::ZoneServer, "Loading factions"); LogInfo("Loading factions");
database.LoadFactionData(); database.LoadFactionData();
Log(Logs::General, Logs::ZoneServer, "Loading titles"); LogInfo("Loading titles");
title_manager.LoadTitles(); title_manager.LoadTitles();
Log(Logs::General, Logs::ZoneServer, "Loading tributes"); LogInfo("Loading tributes");
database.LoadTributes(); database.LoadTributes();
Log(Logs::General, Logs::ZoneServer, "Loading corpse timers"); LogInfo("Loading corpse timers");
database.GetDecayTimes(npcCorpseDecayTimes); database.GetDecayTimes(npcCorpseDecayTimes);
Log(Logs::General, Logs::ZoneServer, "Loading profanity list"); LogInfo("Loading profanity list");
if (!EQEmu::ProfanityManager::LoadProfanityList(&database)) if (!EQEmu::ProfanityManager::LoadProfanityList(&database))
Log(Logs::General, Logs::Error, "Loading profanity list FAILED!"); Log(Logs::General, Logs::Error, "Loading profanity list FAILED!");
Log(Logs::General, Logs::ZoneServer, "Loading commands"); LogInfo("Loading commands");
int retval = command_init(); int retval = command_init();
if (retval<0) if (retval<0)
Log(Logs::General, Logs::Error, "Command loading FAILED"); Log(Logs::General, Logs::Error, "Command loading FAILED");
else else
Log(Logs::General, Logs::ZoneServer, "%d commands loaded", retval); LogInfo("{} commands loaded", retval);
//rules: //rules:
{ {
std::string tmp; std::string tmp;
if (database.GetVariable("RuleSet", 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)) { 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()); Log(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
} }
} }
else { else {
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) { 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 { else {
Log(Logs::General, Logs::ZoneServer, "Loaded default rule set 'default'", tmp.c_str()); LogInfo("Loaded default rule set 'default'");
} }
} }
EQEmu::InitializeDynamicLookups(); EQEmu::InitializeDynamicLookups();
Log(Logs::General, Logs::ZoneServer, "Initialized dynamic dictionary entries"); LogInfo("Initialized dynamic dictionary entries");
} }
#ifdef BOTS #ifdef BOTS
@ -407,7 +407,7 @@ int main(int argc, char** argv) {
#endif #endif
//now we have our parser, load the quests //now we have our parser, load the quests
Log(Logs::General, Logs::ZoneServer, "Loading quests"); LogInfo("Loading quests");
parse->ReloadQuests(); parse->ReloadQuests();
worldserver.Connect(); worldserver.Connect();
@ -420,7 +420,7 @@ int main(int argc, char** argv) {
#endif #endif
#endif #endif
if (!strlen(zone_name) || !strcmp(zone_name, ".")) { 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)) { else if (!Zone::Bootup(database.GetZoneID(zone_name), instance_id, true)) {
Log(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup"); Log(Logs::General, Logs::Error, "Zone Bootup failed :: Zone::Bootup");
@ -478,7 +478,7 @@ int main(int argc, char** argv) {
* EQStreamManager * EQStreamManager
*/ */
if (!eqsf_open && Config->ZonePort != 0) { 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)); EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream));
opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS); opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
@ -607,7 +607,7 @@ int main(int argc, char** argv) {
bot_command_deinit(); bot_command_deinit();
#endif #endif
safe_delete(parse); safe_delete(parse);
Log(Logs::General, Logs::ZoneServer, "Proper zone shutdown complete."); LogInfo("Proper zone shutdown complete.");
LogSys.CloseFileLogs(); LogSys.CloseFileLogs();
return 0; return 0;
} }
@ -623,7 +623,7 @@ void Shutdown()
{ {
Zone::Shutdown(true); Zone::Shutdown(true);
RunLoops = false; RunLoops = false;
Log(Logs::General, Logs::ZoneServer, "Shutting down..."); LogInfo("Shutting down...");
LogSys.CloseFileLogs(); LogSys.CloseFileLogs();
} }

View File

@ -1050,7 +1050,7 @@ int QuestParserCollection::DispatchEventSpell(QuestEventID evt, NPC* npc, Client
void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings* perl_event_export_settings) { 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) */ /* Write Defaults First (All Enabled) */
for (int i = 0; i < _LargestEventID; i++){ for (int i = 0; i < _LargestEventID; i++){

View File

@ -816,12 +816,12 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
(eq_time.hour >= 13) ? "pm" : "am" (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); zone->SetZoneHasCurrentTime(true);
} }
if (zone && zone->is_zone_time_localized) { 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; break;
} }
@ -1942,32 +1942,32 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
case ServerOP_ChangeSharedMem: case ServerOP_ChangeSharedMem:
{ {
std::string hotfix_name = std::string((char*)pack->pBuffer); std::string hotfix_name = std::string((char*)pack->pBuffer);
Log(Logs::General, Logs::ZoneServer, "Loading items"); LogInfo("Loading items");
if (!database.LoadItems(hotfix_name)) { if (!database.LoadItems(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading items FAILED!"); 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)) { if (!database.LoadNPCFactionLists(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading npcs faction lists FAILED!"); 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)) { if (!database.LoadLoot(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading loot FAILED!"); 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))) { if (!database.LoadSkillCaps(std::string(hotfix_name))) {
Log(Logs::General, Logs::Error, "Loading skill caps FAILED!"); 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)) { if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
Log(Logs::General, Logs::Error, "Loading spells FAILED!"); 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)) { if (!database.LoadBaseData(hotfix_name)) {
Log(Logs::General, Logs::Error, "Loading base data FAILED!"); Log(Logs::General, Logs::Error, "Loading base data FAILED!");
} }

View File

@ -1459,7 +1459,7 @@ void Zone::StartShutdownTimer(uint32 set_time) {
set_time = static_cast<uint32>(database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion())); set_time = static_cast<uint32>(database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion()));
} }
autoshutdown_timer.SetTimer(set_time); 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, 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 */ /* By Default we update worlds time, but we can optionally no update world which updates the rest of the zone servers */
if (update_world){ 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); worldserver.SendPacket(pack);
/* Set Time Localization Flag */ /* 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 */ /* When we don't update world, we are localizing ourselves, we become disjointed from normal syncs and set time locally */
else{ 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); 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)); auto outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));