mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
Debug message function updates
This commit is contained in:
parent
b219d73163
commit
4bf2bfc8e3
@ -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; }
|
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);
|
std::string output_message = vStringFormat(message.c_str(), args);
|
||||||
va_end(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, ...)
|
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);
|
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];
|
char time_stamp[80];
|
||||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
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;
|
process_log << time_stamp << " " << StringFormat("[%s] ", TypeNames[log_type]).c_str() << output_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::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){
|
if (log_type > EQEmuLogSys::MaxLogID){
|
||||||
return;
|
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; }
|
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
|
#ifdef _WINDOWS
|
||||||
HANDLE console_handle;
|
HANDLE console_handle;
|
||||||
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
@ -237,7 +254,7 @@ void EQEmuLogSys::ConsoleMessage(uint16 log_type, const std::string message)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::cout << "[N::" << TypeNames[log_type] << "] " << message << "\n";
|
std::cout << "[N::" << TypeNames[log_type] << "] " << category << message << "\n";
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
/* Always set back to white*/
|
/* Always set back to white*/
|
||||||
|
|||||||
@ -74,11 +74,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void CloseZoneLogs();
|
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 LoadLogSettings();
|
||||||
void Log(uint16 log_type, const std::string message, ...);
|
void Log(uint16 log_type, const std::string message, ...);
|
||||||
void LogDebug(DebugLevel debug_level, 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 MakeDirectory(std::string directory_name);
|
||||||
void SetCurrentTimeStamp(char* time_stamp);
|
void SetCurrentTimeStamp(char* time_stamp);
|
||||||
void StartLogs(const std::string log_name);
|
void StartLogs(const std::string log_name);
|
||||||
@ -98,6 +98,7 @@ 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_type, std::string&)> on_log_gmsay_hook;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EQEmuLogSys logger;
|
extern EQEmuLogSys logger;
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
#include "../common/features.h"
|
#include "../common/features.h"
|
||||||
|
#include "../common/eqemu_logsys.h"
|
||||||
|
|
||||||
#ifdef CLIENT_LOGS
|
#ifdef CLIENT_LOGS
|
||||||
#include "client_logs.h"
|
#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);
|
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){
|
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
|
#endif //CLIENT_LOGS
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user