mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Add struct member LogSettings::is_category_enabled so that it can be used for fast checking in intense portions of code
This commit is contained in:
parent
5f64b1e1c8
commit
46ac254b3a
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user