diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index d2e839ddf..a0220e282 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -136,7 +136,7 @@ void EQEmuLogSys::StartLogs(const std::string log_name) } } -void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...) +void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...) { if (RuleI(Logging, DebugLogLevel) < debug_level){ return; } @@ -145,7 +145,19 @@ void EQEmuLogSys::LogDebugType(DebugLevel debug_level, uint16 log_type, std::str std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); + + std::string category_string = ""; + if (log_category > 0 && LogCategoryName[log_category]){ + category_string = StringFormat("[%s]", LogCategoryName[log_category]); + } + + std::string output_debug_message = StringFormat("%s %s", category_string.c_str(), output_message.c_str()); + + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + on_log_gmsay_hook(EQEmuLogSys::LogType::Debug, output_debug_message); + } + + EQEmuLogSys::ConsoleMessage(EQEmuLogSys::Debug, log_category, output_message); } void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) @@ -197,7 +209,7 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) on_log_gmsay_hook(log_type, output_message); } - EQEmuLogSys::ConsoleMessage(log_type, output_message); + EQEmuLogSys::ConsoleMessage(log_type, 0, output_message); char time_stamp[80]; EQEmuLogSys::SetCurrentTimeStamp(time_stamp); @@ -206,11 +218,11 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_message << std::endl; } 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::ConsoleMessage(uint16 log_type, const std::string message) +void EQEmuLogSys::ConsoleMessage(uint16 log_type, uint16 log_category, const std::string message) { if (log_type > EQEmuLogSys::MaxLogID){ return; @@ -220,6 +232,11 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) } if (!RuleB(Logging, ConsoleLogCommands) && log_type == EQEmuLogSys::LogType::Commands){ return; } + std::string category = ""; + if (log_category > 0 && LogCategoryName[log_category]){ + category = StringFormat("[%s] ", LogCategoryName[log_category]); + } + #ifdef _WINDOWS HANDLE console_handle; console_handle = GetStdHandle(STD_OUTPUT_HANDLE); @@ -237,7 +254,7 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message) } #endif - std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n"; + std::cout << "[N::" << TypeNames[log_type] << "] " << category << message << "\n"; #ifdef _WINDOWS /* Always set back to white*/ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index f99273313..3440f5a5e 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -74,11 +74,11 @@ public: }; void CloseZoneLogs(); - void ConsoleMessage(uint16 log_type, const std::string message); + void ConsoleMessage(uint16 log_type, uint16 log_category, const std::string message); void LoadLogSettings(); void Log(uint16 log_type, const std::string message, ...); void LogDebug(DebugLevel debug_level, std::string message, ...); - void LogDebugType(DebugLevel debug_level, uint16 log_type, std::string message, ...); + void LogDebugType(DebugLevel debug_level, uint16 log_category, std::string message, ...); void MakeDirectory(std::string directory_name); void SetCurrentTimeStamp(char* time_stamp); void StartLogs(const std::string log_name); @@ -98,6 +98,7 @@ public: private: bool zone_general_init = false; std::function on_log_gmsay_hook; + }; extern EQEmuLogSys logger; diff --git a/zone/client_logs.cpp b/zone/client_logs.cpp index f2ead3a59..15079df60 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -17,6 +17,7 @@ */ #include "../common/debug.h" #include "../common/features.h" +#include "../common/eqemu_logsys.h" #ifdef CLIENT_LOGS #include "client_logs.h" @@ -135,8 +136,18 @@ void ClientLogs::EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char client_logs.msg(id, _buffer); } +static uint32 gmsay_log_message_colors[EQEmuLogSys::MaxLogID] = { + 15, // "Status", - Yellow + 15, // "Normal", - Yellow + 3, // "Error", - Red + 14, // "Debug", - Light Green + 4, // "Quest", + 5, // "Command", + 3 // "Crash" +}; + void ClientLogs::ClientMessage(uint16 log_type, std::string& message){ - entity_list.MessageStatus(0, 80, 7, "%s", message.c_str()); + entity_list.MessageStatus(0, 80, gmsay_log_message_colors[log_type], "%s", message.c_str()); } #endif //CLIENT_LOGS