mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-19 11:42:25 +00:00
Refactor ProcessConsoleMessage to no longer use type
This commit is contained in:
parent
564bff07fe
commit
40d12d952e
@ -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);
|
||||
}
|
||||
|
||||
@ -101,11 +101,11 @@ public:
|
||||
|
||||
private:
|
||||
bool zone_general_init = false;
|
||||
std::function<void(uint16 log_type, std::string&)> on_log_gmsay_hook;
|
||||
std::function<void(uint16 log_category, std::string&)> 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);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user