diff --git a/common/database.cpp b/common/database.cpp index f852ae37e..dd95103ba 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -4257,3 +4257,28 @@ uint32 Database::GetGuildIDByCharID(uint32 char_id) auto row = results.begin(); return atoi(row[0]); } + +void Database::LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings){ + std::string query = + "SELECT " + "log_category_id, " + "log_category_description, " + "log_to_console, " + "log_to_file, " + "log_to_gmsay " + "FROM " + "logsys_categories " + "ORDER BY log_category_id"; + auto results = QueryDatabase(query); + int log_category = 0; + for (auto row = results.begin(); row != results.end(); ++row) { + log_category = atoi(row[0]); + log_settings[log_category].log_to_console = atoi(row[2]); + log_settings[log_category].log_to_file = atoi(row[3]); + log_settings[log_category].log_to_gmsay = atoi(row[4]); + std::cout << "Setting log settings for " << log_category << " " << LogCategoryName[log_category] << " " << std::endl; + std::cout << "--- log_to_console = " << atoi(row[2]) << std::endl; + std::cout << "--- log_to_file = " << atoi(row[3]) << std::endl; + std::cout << "--- log_to_gmsay = " << atoi(row[4]) << std::endl; + } +} \ No newline at end of file diff --git a/common/database.h b/common/database.h index f45b83600..424a0dfa9 100644 --- a/common/database.h +++ b/common/database.h @@ -645,6 +645,9 @@ public: void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon); void AddReport(std::string who, std::string against, std::string lines); + /* EQEmuLogSys */ + void LoadLogSysSettings(EQEmuLogSys::LogSettings* log_settings); + private: void DBInitVars(); diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index b60687300..5b13438d1 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -20,6 +20,7 @@ #include "eqemu_logsys.h" #include "platform.h" #include "string_util.h" +#include "database.h" #include #include @@ -70,30 +71,6 @@ static const char* TypeNames[EQEmuLogSys::MaxLogID] = { "Crash", }; -/* If you add to this, make sure you update LogCategory in eqemu_logsys.h */ -static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { - "Zone", - "World", - "UCS", - "QueryServer", - "WebInterface", - "AA", - "Doors", - "Guild", - "Inventory", - "Launcher", - "Netcode", - "Object", - "Rules", - "Skills", - "Spawns", - "Spells", - "Tasks", - "Trading", - "Tradeskills", - "Tribute", -}; - static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { Console::Color::Yellow, // "Status", Console::Color::Yellow, // "Normal", @@ -121,7 +98,7 @@ void EQEmuLogSys::LoadLogSettings() log_settings[i].log_to_console = 1; log_settings[i].log_to_file = 1; log_settings[i].log_to_gmsay = 1; - std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; + // std::cout << "Setting log settings for " << i << " " << LogCategoryName[i] << " " << std::endl; } log_settings_loaded = true; } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 5eed3e181..669d06ea9 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -48,7 +48,7 @@ public: Detail, /* 2 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; - /* If you add to this, make sure you update LogCategoryName in eqemu_logsys.cpp */ + /* If you add to this, make sure you update LogCategoryName */ enum LogCategory { Zone_Server = 0, World_Server, @@ -108,5 +108,28 @@ private: extern EQEmuLogSys logger; +/* If you add to this, make sure you update LogCategory */ +static const char* LogCategoryName[EQEmuLogSys::LogCategory::MaxCategoryID] = { + "Zone", + "World", + "UCS", + "QueryServer", + "WebInterface", + "AA", + "Doors", + "Guild", + "Inventory", + "Launcher", + "Netcode", + "Object", + "Rules", + "Skills", + "Spawns", + "Spells", + "Tasks", + "Trading", + "Tradeskills", + "Tribute", +}; #endif \ No newline at end of file diff --git a/zone/zonedb.h b/zone/zonedb.h index 1c103074a..56d9a2b25 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -4,6 +4,7 @@ #include "../common/shareddb.h" #include "../common/eq_packet_structs.h" #include "../common/faction.h" +#include "../common/eqemu_logsys.h" class Client; class Corpse;