mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-11 15:22:26 +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);
|
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||||
|
|
||||||
if (process_log){
|
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{
|
else{
|
||||||
// std::cout << "[DEBUG] " << ":: There currently is no log file open for this process " << "\n";
|
// 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 */
|
/* Check if category enabled for process */
|
||||||
if (log_settings[log_category].log_to_console == 0)
|
if (log_settings[log_category].log_to_console == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (log_type > EQEmuLogSys::MaxLogID){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
HANDLE console_handle;
|
HANDLE console_handle;
|
||||||
console_handle = GetStdHandle(STD_OUTPUT_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;
|
info.FontWeight = FW_NORMAL;
|
||||||
wcscpy(info.FaceName, L"Lucida Console");
|
wcscpy(info.FaceName, L"Lucida Console");
|
||||||
SetCurrentConsoleFontEx(console_handle, NULL, &info);
|
SetCurrentConsoleFontEx(console_handle, NULL, &info);
|
||||||
if (LogColors[log_type]){
|
//if (LogColors[log_type]){
|
||||||
SetConsoleTextAttribute(console_handle, LogColors[log_type]);
|
// SetConsoleTextAttribute(console_handle, LogColors[log_type]);
|
||||||
}
|
//}
|
||||||
else{
|
//else{
|
||||||
SetConsoleTextAttribute(console_handle, Console::Color::White);
|
SetConsoleTextAttribute(console_handle, Console::Color::White);
|
||||||
}
|
//}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::cout << "[" << TypeNames[log_type] << "] " << message << "\n";
|
std::cout << "[" << LogCategoryName[log_category] << "] " << message << "\n";
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
/* Always set back to white*/
|
/* 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);
|
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::ProcessGMSay(log_category, output_debug_message);
|
||||||
EQEmuLogSys::ProcessLogWrite(log_category, output_debug_message);
|
EQEmuLogSys::ProcessLogWrite(log_category, output_debug_message);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,11 +101,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool zone_general_init = false;
|
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);
|
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 ProcessGMSay(uint16 log_category, std::string message);
|
||||||
void ProcessLogWrite(uint16 log_category, std::string message);
|
void ProcessLogWrite(uint16 log_category, std::string message);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user