diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 1d1a732af..1d0af0bb4 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -106,6 +106,7 @@ static Console::Color LogColors[EQEmuLogSys::MaxLogID] = { EQEmuLogSys::EQEmuLogSys(){ + on_log_gmsay_hook = [](uint16 log_type, std::string&) {}; } EQEmuLogSys::~EQEmuLogSys(){ @@ -154,7 +155,6 @@ void EQEmuLogSys::LogDebug(DebugLevel debug_level, std::string message, ...) va_start(args, message); std::string output_message = vStringFormat(message.c_str(), args); va_end(args); - EQEmuLogSys::Log(EQEmuLogSys::LogType::Debug, output_message); } @@ -191,6 +191,10 @@ void EQEmuLogSys::Log(uint16 log_type, const std::string message, ...) std::string output_message = vStringFormat(message.c_str(), args); va_end(args); + if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){ + on_log_gmsay_hook(output_message); + } + EQEmuLogSys::ConsoleMessage(log_type, output_message); char time_stamp[80]; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 9a0586f7e..037a06feb 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -21,6 +21,9 @@ #include #include +#include +#include + #include "types.h" class EQEmuLogSys { @@ -89,9 +92,11 @@ public: bool log_settings_loaded = false; int log_platform = 0; + void OnLogHookCallBack(std::function f) { on_log_gmsay_hook = f; } + 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 4aba31159..f2ead3a59 100644 --- a/zone/client_logs.cpp +++ b/zone/client_logs.cpp @@ -21,6 +21,7 @@ #ifdef CLIENT_LOGS #include "client_logs.h" #include "client.h" +#include "entity.h" #include ClientLogs client_logs; @@ -134,6 +135,10 @@ void ClientLogs::EQEmuIO_pva(EQEmuLog::LogIDs id, const char *prefix, const char client_logs.msg(id, _buffer); } +void ClientLogs::ClientMessage(uint16 log_type, std::string& message){ + entity_list.MessageStatus(0, 80, 7, "%s", message.c_str()); +} + #endif //CLIENT_LOGS diff --git a/zone/client_logs.h b/zone/client_logs.h index 4db83a6b1..547c49641 100644 --- a/zone/client_logs.h +++ b/zone/client_logs.h @@ -46,6 +46,7 @@ public: void clear(); //unsubscribes everybody void msg(EQEmuLog::LogIDs id, const char *buf); + static void ClientMessage(uint16 log_type, std::string& message); protected: diff --git a/zone/net.cpp b/zone/net.cpp index 95b7f1396..601a598e5 100644 --- a/zone/net.cpp +++ b/zone/net.cpp @@ -45,6 +45,7 @@ #include "../common/spdat.h" #include "../common/eqemu_logsys.h" +#include "client_logs.h" #include "zone_config.h" #include "masterentity.h" #include "worldserver.h" @@ -115,6 +116,7 @@ extern void MapOpcodes(); int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformZone); logger.LoadLogSettings(); + logger.OnLog(&ClientLogs::ClientMessage); set_exception_handler(); const char *zone_name; diff --git a/zone/zone.cpp b/zone/zone.cpp index 9c00d23cb..98eb41ee3 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -152,7 +152,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { /* Set Logging */ - logger.StartZoneLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); + logger.StartLogs(StringFormat("%s_ver-%u_instid-%u_port-%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort)); return true; }