From 40d12d952eeab6057b6c5f9aa9e2e04f66019686 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 18 Jan 2015 01:45:58 -0600 Subject: [PATCH] Refactor ProcessConsoleMessage to no longer use type --- common/eqemu_logsys.cpp | 22 +++++++++------------- common/eqemu_logsys.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 0322f9c96..a6425284f 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -124,23 +124,19 @@ void EQEmuLogSys::ProcessLogWrite(uint16 log_category, std::string message) EQEmuLogSys::SetCurrentTimeStamp(time_stamp); if (process_log){ - process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << message << std::endl; + process_log << time_stamp << " " << StringFormat("[%s] ", LogCategoryName[log_category]).c_str() << message << std::endl; } else{ // std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n"; } } -void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) +void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string message) { /* Check if category enabled for process */ if (log_settings[log_category].log_to_console == 0) return; - if (log_type > EQEmuLogSys::MaxLogID){ - return; - } - #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -150,15 +146,15 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_type, uint16 log_category, co info.FontWeight = FW_NORMAL; wcscpy(info.FaceName, L"Lucida Console"); SetCurrentConsoleFontEx(console_handle, NULL, &info); - if (LogColors[log_type]){ - SetConsoleTextAttribute(console_handle, LogColors[log_type]); - } - else{ + //if (LogColors[log_type]){ + // SetConsoleTextAttribute(console_handle, LogColors[log_type]); + //} + //else{ SetConsoleTextAttribute(console_handle, Console::Color::White); - } + //} #endif - std::cout << "[" << TypeNames[log_type] << "] " << message << "\n"; + std::cout << "[" << LogCategoryName[log_category] << "] " << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ @@ -175,7 +171,7 @@ void EQEmuLogSys::DebugCategory(DebugLevel debug_level, uint16 log_category, std std::string output_debug_message = EQEmuLogSys::FormatDebugCategoryMessageString(log_category, output_message); - EQEmuLogSys::ProcessConsoleMessage(EQEmuLogSys::Debug, log_category, output_debug_message); + EQEmuLogSys::ProcessConsoleMessage(log_category, output_debug_message); EQEmuLogSys::ProcessGMSay(log_category, output_debug_message); EQEmuLogSys::ProcessLogWrite(log_category, output_debug_message); } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 11bf6d3c0..9955a2f2e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -101,11 +101,11 @@ public: private: bool zone_general_init = false; - std::function on_log_gmsay_hook; + std::function on_log_gmsay_hook; std::string FormatDebugCategoryMessageString(uint16 log_category, std::string in_message); - void ProcessConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); + void ProcessConsoleMessage(uint16 log_category, const std::string message); void ProcessGMSay(uint16 log_category, std::string message); void ProcessLogWrite(uint16 log_category, std::string message); };