diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 647628296..13302fbd2 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -269,6 +269,13 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...) { + 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 nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay; + + if (nothing_to_log) return; + va_list args; va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); @@ -276,9 +283,9 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message); - EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message); - EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message); - EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_message); + if (log_to_console) EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message); + if (log_to_gmsay) EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message); + if (log_to_file) EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_message); } void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp) diff --git a/zone/command.cpp b/zone/command.cpp index 52389c342..ce6825a2e 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10472,19 +10472,10 @@ void command_logtest(Client *c, const Seperator *sep){ clock_t t = std::clock(); /* Function timer start */ if (sep->IsNumber(1)){ uint32 i = 0; - std::ofstream log_test; - for (i = 0; i < atoi(sep->arg[1]); i++){ - log_test.open("logs/log_test.txt", std::ios_base::app | std::ios_base::out); - log_test << "this is a test\n"; - log_test.close(); - } - Log.Out(Logs::General, Logs::Zone_Server, "[%u] Test #1... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); t = std::clock(); - log_test.open("logs/log_test.txt", std::ios_base::app | std::ios_base::out); for (i = 0; i < atoi(sep->arg[1]); i++){ - Log.Out(Logs::General, Logs::Zone_Server, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); + Log.Out(Logs::General, Logs::Debug, "[%u] Test #2... Took %f seconds", i, ((float)(std::clock() - t)) / CLOCKS_PER_SEC); } - log_test.close(); } } diff --git a/zone/net.cpp b/zone/net.cpp index dd96f0e17..c35add8c3 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -151,7 +151,7 @@ int main(int argc, char** argv) { Log.Out(Logs::General, Logs::Error, "Loading server configuration failed."); return 1; } - const ZoneConfig *Config=ZoneConfig::get(); + const ZoneConfig *Config = ZoneConfig::get(); worldserver.SetPassword(Config->SharedKey.c_str());