diff --git a/common/database.cpp b/common/database.cpp index 98639c6af..d632977e0 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -2154,6 +2154,16 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings) log_settings[log_category].log_to_file = atoi(row[3]); log_settings[log_category].log_to_gmsay = atoi(row[4]); + /* Determine if any output method is enabled for the category + and set it to 1 so it can used to check if category is enabled */ + const bool log_to_console = log_settings[log_category].log_to_console > 0; + const bool log_to_file = log_settings[log_category].log_to_file > 0; + const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0; + const bool is_category_enabled = !log_to_console && !log_to_file && !log_to_gmsay; + + if (is_category_enabled) + log_settings[log_category].is_category_enabled = 1; + /* This determines whether or not the process needs to actually file log anything. If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 38fbea68b..a29b163c9 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -160,6 +160,7 @@ public: uint8 log_to_file; uint8 log_to_console; uint8 log_to_gmsay; + uint8 is_category_enabled; /* When any log output in a category > 0, set this to 1 as (Enabled) */ }; /* Internally used memory reference for all log settings per category. diff --git a/queryserv/database.cpp b/queryserv/database.cpp index e788c801c..d0730d097 100644 --- a/queryserv/database.cpp +++ b/queryserv/database.cpp @@ -386,6 +386,16 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings){ log_settings[log_category].log_to_file = atoi(row[3]); log_settings[log_category].log_to_gmsay = atoi(row[4]); + /* Determine if any output method is enabled for the category + and set it to 1 so it can used to check if category is enabled */ + const bool log_to_console = log_settings[log_category].log_to_console > 0; + const bool log_to_file = log_settings[log_category].log_to_file > 0; + const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0; + const bool is_category_enabled = !log_to_console && !log_to_file && !log_to_gmsay; + + if (is_category_enabled) + log_settings[log_category].is_category_enabled = 1; + /* This determines whether or not the process needs to actually file log anything. If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open diff --git a/ucs/database.cpp b/ucs/database.cpp index b80b4fb78..51dd4ecd5 100644 --- a/ucs/database.cpp +++ b/ucs/database.cpp @@ -600,6 +600,16 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings){ log_settings[log_category].log_to_file = atoi(row[3]); log_settings[log_category].log_to_gmsay = atoi(row[4]); + /* Determine if any output method is enabled for the category + and set it to 1 so it can used to check if category is enabled */ + const bool log_to_console = log_settings[log_category].log_to_console > 0; + const bool log_to_file = log_settings[log_category].log_to_file > 0; + const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0; + const bool is_category_enabled = !log_to_console && !log_to_file && !log_to_gmsay; + + if (is_category_enabled) + log_settings[log_category].is_category_enabled = 1; + /* This determines whether or not the process needs to actually file log anything. If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open