mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Add zone callback for client messages so log messages can be piped to it
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <functional>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
class EQEmuLogSys {
|
||||
@@ -89,9 +92,11 @@ public:
|
||||
bool log_settings_loaded = false;
|
||||
int log_platform = 0;
|
||||
|
||||
void OnLogHookCallBack(std::function<void(uint16 log_type, std::string&)> f) { on_log_gmsay_hook = f; }
|
||||
|
||||
private:
|
||||
bool zone_general_init = false;
|
||||
|
||||
std::function<void(uint16 log_type, std::string&)> on_log_gmsay_hook;
|
||||
};
|
||||
|
||||
extern EQEmuLogSys logger;
|
||||
|
||||
Reference in New Issue
Block a user