mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 23:01:30 +00:00
[Logging] Improvements to GM Say Logging (#2765)
This commit is contained in:
parent
d3e756287e
commit
900837f633
@ -55,7 +55,7 @@ std::ofstream process_log;
|
|||||||
*/
|
*/
|
||||||
EQEmuLogSys::EQEmuLogSys()
|
EQEmuLogSys::EQEmuLogSys()
|
||||||
{
|
{
|
||||||
m_on_log_gmsay_hook = [](uint16 log_type, const std::string &) {};
|
m_on_log_gmsay_hook = [](uint16 log_type, const char *func, const std::string &) {};
|
||||||
m_on_log_console_hook = [](uint16 log_type, const std::string &) {};
|
m_on_log_console_hook = [](uint16 log_type, const std::string &) {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +412,7 @@ void EQEmuLogSys::Out(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (l.log_to_gmsay_enabled) {
|
if (l.log_to_gmsay_enabled) {
|
||||||
m_on_log_gmsay_hook(log_category, output_message);
|
m_on_log_gmsay_hook(log_category, func, output_message);
|
||||||
}
|
}
|
||||||
if (l.log_to_file_enabled) {
|
if (l.log_to_file_enabled) {
|
||||||
EQEmuLogSys::ProcessLogWrite(
|
EQEmuLogSys::ProcessLogWrite(
|
||||||
|
|||||||
@ -344,7 +344,7 @@ public:
|
|||||||
// gmsay
|
// gmsay
|
||||||
uint16 GetGMSayColorFromCategory(uint16 log_category);
|
uint16 GetGMSayColorFromCategory(uint16 log_category);
|
||||||
|
|
||||||
EQEmuLogSys *SetGMSayHandler(std::function<void(uint16 log_type, const std::string &)> f)
|
EQEmuLogSys *SetGMSayHandler(const std::function<void(uint16 log_type, const char *func, const std::string &)>& f)
|
||||||
{
|
{
|
||||||
m_on_log_gmsay_hook = f;
|
m_on_log_gmsay_hook = f;
|
||||||
return this;
|
return this;
|
||||||
@ -376,7 +376,7 @@ private:
|
|||||||
|
|
||||||
// reference to database
|
// reference to database
|
||||||
Database *m_database;
|
Database *m_database;
|
||||||
std::function<void(uint16 log_category, const std::string &)> m_on_log_gmsay_hook;
|
std::function<void(uint16 log_category, const char *func, const std::string &)> m_on_log_gmsay_hook;
|
||||||
std::function<void(uint16 log_category, int webhook_id, const std::string &)> m_on_log_discord_hook;
|
std::function<void(uint16 log_category, int webhook_id, const std::string &)> m_on_log_discord_hook;
|
||||||
std::function<void(uint16 log_category, const std::string &)> m_on_log_console_hook;
|
std::function<void(uint16 log_category, const std::string &)> m_on_log_console_hook;
|
||||||
DiscordWebhooks m_discord_webhooks[MAX_DISCORD_WEBHOOK_ID]{};
|
DiscordWebhooks m_discord_webhooks[MAX_DISCORD_WEBHOOK_ID]{};
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern WorldConfig Config;
|
extern WorldConfig Config;
|
||||||
|
|
||||||
void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, std::string message)
|
void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, const char *func, std::string message)
|
||||||
{
|
{
|
||||||
// we don't want to loop up with chat messages
|
// we don't want to loop up with chat messages
|
||||||
if (message.find("OP_SpecialMesg") != std::string::npos) {
|
if (message.find("OP_SpecialMesg") != std::string::npos) {
|
||||||
@ -71,7 +71,7 @@ void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, std::string m
|
|||||||
AccountStatus::QuestTroupe,
|
AccountStatus::QuestTroupe,
|
||||||
LogSys.GetGMSayColorFromCategory(log_category),
|
LogSys.GetGMSayColorFromCategory(log_category),
|
||||||
"%s",
|
"%s",
|
||||||
message.c_str()
|
fmt::format("[{}] [{}] {}", Logs::LogCategoryName[log_category], func, message).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class WorldBoot {
|
class WorldBoot {
|
||||||
public:
|
public:
|
||||||
static void GMSayHookCallBackProcessWorld(uint16 log_category, std::string message);
|
static void GMSayHookCallBackProcessWorld(uint16 log_category, const char *func, std::string message);
|
||||||
static bool HandleCommandInput(int argc, char **argv);
|
static bool HandleCommandInput(int argc, char **argv);
|
||||||
static bool LoadServerConfig();
|
static bool LoadServerConfig();
|
||||||
static bool LoadDatabaseConnections();
|
static bool LoadDatabaseConnections();
|
||||||
|
|||||||
@ -327,7 +327,7 @@ public:
|
|||||||
* @param log_category
|
* @param log_category
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
static void GMSayHookCallBackProcess(uint16 log_category, std::string message)
|
static void GMSayHookCallBackProcess(uint16 log_category, const char *func, std::string message)
|
||||||
{
|
{
|
||||||
// we don't want to loop up with chat messages
|
// we don't want to loop up with chat messages
|
||||||
if (message.find("OP_SpecialMesg") != std::string::npos) {
|
if (message.find("OP_SpecialMesg") != std::string::npos) {
|
||||||
@ -372,7 +372,7 @@ public:
|
|||||||
0,
|
0,
|
||||||
AccountStatus::QuestTroupe,
|
AccountStatus::QuestTroupe,
|
||||||
LogSys.GetGMSayColorFromCategory(log_category),
|
LogSys.GetGMSayColorFromCategory(log_category),
|
||||||
message.c_str()
|
fmt::format("[{}] [{}] {}", Logs::LogCategoryName[log_category], func, message).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user