mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
[Code] EQEmuLogSys Global to Singleton Cleanup (#4925)
* [Code] EQEmuLogSys Global to Singleton Cleanup * Post merge fix
This commit is contained in:
parent
1153c9ab96
commit
947795f1d1
@ -38,7 +38,6 @@
|
|||||||
#include "../../common/skill_caps.h"
|
#include "../../common/skill_caps.h"
|
||||||
#include "../../common/evolving_items.h"
|
#include "../../common/evolving_items.h"
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
EvolvingItemsManager evolving_items_manager;
|
||||||
@ -51,7 +50,7 @@ void ExportDBStrings(SharedDatabase *db);
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
@ -97,7 +96,7 @@ int main(int argc, char **argv)
|
|||||||
content_db.SetMySQL(database);
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
@ -127,7 +126,7 @@ int main(int argc, char **argv)
|
|||||||
ExportBaseData(&content_db);
|
ExportBaseData(&content_db);
|
||||||
ExportDBStrings(&database);
|
ExportDBStrings(&database);
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,6 @@
|
|||||||
#include "../../common/events/player_event_logs.h"
|
#include "../../common/events/player_event_logs.h"
|
||||||
#include "../../common/evolving_items.h"
|
#include "../../common/evolving_items.h"
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
EvolvingItemsManager evolving_items_manager;
|
||||||
@ -44,7 +43,7 @@ void ImportDBStrings(SharedDatabase *db);
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
@ -90,7 +89,7 @@ int main(int argc, char **argv) {
|
|||||||
content_db.SetMySQL(database);
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
@ -100,7 +99,7 @@ int main(int argc, char **argv) {
|
|||||||
ImportBaseData(&content_db);
|
ImportBaseData(&content_db);
|
||||||
ImportDBStrings(&database);
|
ImportDBStrings(&database);
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,8 @@ void SendCrashReport(const std::string &crash_report)
|
|||||||
// "http://localhost:3010/api/v1/analytics/server-crash-report", // development
|
// "http://localhost:3010/api/v1/analytics/server-crash-report", // development
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EQEmuLogSys* log = EQEmuLogSys::Instance();
|
||||||
|
|
||||||
auto config = EQEmuConfig::get();
|
auto config = EQEmuConfig::get();
|
||||||
for (auto &e: endpoints) {
|
for (auto &e: endpoints) {
|
||||||
uri u(e);
|
uri u(e);
|
||||||
@ -68,12 +70,12 @@ void SendCrashReport(const std::string &crash_report)
|
|||||||
p["cpus"] = cpus.size();
|
p["cpus"] = cpus.size();
|
||||||
p["origination_info"] = "";
|
p["origination_info"] = "";
|
||||||
|
|
||||||
if (!LogSys.origination_info.zone_short_name.empty()) {
|
if (!log->origination_info.zone_short_name.empty()) {
|
||||||
p["origination_info"] = fmt::format(
|
p["origination_info"] = fmt::format(
|
||||||
"{} ({}) instance_id [{}]",
|
"{} ({}) instance_id [{}]",
|
||||||
LogSys.origination_info.zone_short_name,
|
log->origination_info.zone_short_name,
|
||||||
LogSys.origination_info.zone_long_name,
|
log->origination_info.zone_long_name,
|
||||||
LogSys.origination_info.instance_id
|
log->origination_info.instance_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +296,7 @@ void print_trace()
|
|||||||
SendCrashReport(crash_report);
|
SendCrashReport(crash_report);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,7 +204,7 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsDumpOutputToConsole()) {
|
if (IsDumpOutputToConsole()) {
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo("MySQL installed [{}]", GetMySQLVersion());
|
LogInfo("MySQL installed [{}]", GetMySQLVersion());
|
||||||
@ -324,7 +324,7 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!IsDumpOutputToConsole()) {
|
if (!IsDumpOutputToConsole()) {
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pipe_file.empty()) {
|
if (!pipe_file.empty()) {
|
||||||
|
|||||||
@ -154,7 +154,7 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
std::vector<int> missing_migrations = {};
|
std::vector<int> missing_migrations = {};
|
||||||
if (version_low != version_high) {
|
if (version_low != version_high) {
|
||||||
|
|
||||||
LogSys.DisableMySQLErrorLogs();
|
EQEmuLogSys::Instance()->DisableMySQLErrorLogs();
|
||||||
bool force_interactive = false;
|
bool force_interactive = false;
|
||||||
for (int version = version_low + 1; version <= version_high; ++version) {
|
for (int version = version_low + 1; version <= version_high; ++version) {
|
||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
@ -184,7 +184,7 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogSys.EnableMySQLErrorLogs();
|
EQEmuLogSys::Instance()->EnableMySQLErrorLogs();
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
|
|
||||||
if (!missing_migrations.empty() && m_skip_backup) {
|
if (!missing_migrations.empty() && m_skip_backup) {
|
||||||
|
|||||||
@ -160,7 +160,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
|||||||
(uint32) mysql_insert_id(mysql)
|
(uint32) mysql_insert_id(mysql)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
||||||
if ((strncasecmp(query, "select", 6) == 0)) {
|
if ((strncasecmp(query, "select", 6) == 0)) {
|
||||||
LogMySQLQuery(
|
LogMySQLQuery(
|
||||||
"{0} -- ({1} row{2} returned) ({3}s)",
|
"{0} -- ({1} row{2} returned) ({3}s)",
|
||||||
|
|||||||
@ -26,7 +26,7 @@ void DiscordManager::ProcessMessageQueue()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto webhook = LogSys.GetDiscordWebhooks()[q.first];
|
auto webhook = EQEmuLogSys::Instance()->GetDiscordWebhooks()[q.first];
|
||||||
std::string message;
|
std::string message;
|
||||||
|
|
||||||
for (auto &m: q.second) {
|
for (auto &m: q.second) {
|
||||||
|
|||||||
@ -545,13 +545,13 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
|
|||||||
uint32 chunksize, used;
|
uint32 chunksize, used;
|
||||||
uint32 length;
|
uint32 length;
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
|
||||||
if (p->GetOpcode() != OP_SpecialMesg){
|
if (p->GetOpcode() != OP_SpecialMesg){
|
||||||
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
|
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
|
||||||
if (p->GetOpcode() != OP_SpecialMesg){
|
if (p->GetOpcode() != OP_SpecialMesg){
|
||||||
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
|
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -656,7 +656,7 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
|||||||
// If we go through this whole loop and nothing is set to any debug level, there
|
// If we go through this whole loop and nothing is set to any debug level, there
|
||||||
// is no point to create a file or keep anything open
|
// is no point to create a file or keep anything open
|
||||||
if (log_settings[c.log_category_id].log_to_file > 0) {
|
if (log_settings[c.log_category_id].log_to_file > 0) {
|
||||||
LogSys.m_file_logs_enabled = true;
|
m_file_logs_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
db_categories.emplace_back(c.log_category_id);
|
db_categories.emplace_back(c.log_category_id);
|
||||||
|
|||||||
@ -266,8 +266,6 @@ namespace Logs {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "eqemu_logsys_log_aliases.h"
|
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
|
|
||||||
constexpr uint16 MAX_DISCORD_WEBHOOK_ID = 300;
|
constexpr uint16 MAX_DISCORD_WEBHOOK_ID = 300;
|
||||||
@ -285,6 +283,12 @@ public:
|
|||||||
EQEmuLogSys *LoadLogSettingsDefaults();
|
EQEmuLogSys *LoadLogSettingsDefaults();
|
||||||
EQEmuLogSys *LoadLogDatabaseSettings(bool silent_load = false);
|
EQEmuLogSys *LoadLogDatabaseSettings(bool silent_load = false);
|
||||||
|
|
||||||
|
static EQEmuLogSys *Instance()
|
||||||
|
{
|
||||||
|
static EQEmuLogSys instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param directory_name
|
* @param directory_name
|
||||||
*/
|
*/
|
||||||
@ -350,7 +354,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Internally used memory reference for all log settings per category
|
* Internally used memory reference for all log settings per category
|
||||||
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
|
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
|
||||||
* Database loaded via LogSys.SetDatabase(&database)->LoadLogDatabaseSettings();
|
* Database loaded via EQEmuLogSys::Instance()->SetDatabase(&database)->LoadLogDatabaseSettings();
|
||||||
*/
|
*/
|
||||||
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
|
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
|
||||||
|
|
||||||
@ -434,7 +438,7 @@ private:
|
|||||||
void InjectTablesIfNotExist();
|
void InjectTablesIfNotExist();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EQEmuLogSys LogSys;
|
#include "eqemu_logsys_log_aliases.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@ -456,7 +460,7 @@ void OutF(
|
|||||||
|
|
||||||
#define OutF(ls, debug_level, log_category, file, func, line, formatStr, ...) \
|
#define OutF(ls, debug_level, log_category, file, func, line, formatStr, ...) \
|
||||||
do { \
|
do { \
|
||||||
ls.Out(debug_level, log_category, file, func, line, fmt::format(formatStr, ##__VA_ARGS__).c_str()); \
|
ls->Out(debug_level, log_category, file, func, line, fmt::format(formatStr, ##__VA_ARGS__).c_str()); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -509,7 +509,7 @@ bool PlayerEventLogs::IsEventDiscordEnabled(int32_t event_type_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensure there is a matching webhook to begin with
|
// ensure there is a matching webhook to begin with
|
||||||
if (!LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
if (!EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,8 +529,8 @@ std::string PlayerEventLogs::GetDiscordWebhookUrlFromEventType(int32_t event_typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensure there is a matching webhook to begin with
|
// ensure there is a matching webhook to begin with
|
||||||
if (!LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
if (!EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
||||||
return LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url;
|
return EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@ -1167,7 +1167,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::NetClient)) {
|
if (EQEmuLogSys::Instance()->IsLogEnabled(Logs::General, Logs::NetClient)) {
|
||||||
size_t total_size = 0;
|
size_t total_size = 0;
|
||||||
for (auto &e: s->sent_packets) {
|
for (auto &e: s->sent_packets) {
|
||||||
total_size += e.second.packet.Length();
|
total_size += e.second.packet.Length();
|
||||||
|
|||||||
@ -71,7 +71,7 @@ void EQ::Net::EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req)
|
|||||||
OpcodeManager::EmuToName(p->GetOpcode()),
|
OpcodeManager::EmuToName(p->GetOpcode()),
|
||||||
(*m_opcode_manager)->EmuToEQ(p->GetOpcode()),
|
(*m_opcode_manager)->EmuToEQ(p->GetOpcode()),
|
||||||
p->Size(),
|
p->Size(),
|
||||||
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketServerClient) ? DumpPacketToString(p) : "")
|
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketServerClient) ? DumpPacketToString(p) : "")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (m_opcode_manager && *m_opcode_manager) {
|
if (m_opcode_manager && *m_opcode_manager) {
|
||||||
|
|||||||
@ -319,7 +319,7 @@ void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
|
|||||||
size_t message_len = length;
|
size_t message_len = length;
|
||||||
EQ::Net::StaticPacket packet(&data[0], message_len);
|
EQ::Net::StaticPacket packet(&data[0], message_len);
|
||||||
|
|
||||||
const auto is_detail_enabled = LogSys.IsLogEnabled(Logs::Detail, Logs::PacketServerToServer);
|
const auto is_detail_enabled = EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketServerToServer);
|
||||||
if (opcode != ServerOP_KeepAlive || is_detail_enabled) {
|
if (opcode != ServerOP_KeepAlive || is_detail_enabled) {
|
||||||
LogPacketServerToServer(
|
LogPacketServerToServer(
|
||||||
"[{:#06x}] Size [{}] {}",
|
"[{:#06x}] Size [{}] {}",
|
||||||
|
|||||||
@ -33,15 +33,13 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
|
|
||||||
bool RunLoops = false;
|
bool RunLoops = false;
|
||||||
|
|
||||||
void CatchSignal(int sig_num);
|
void CatchSignal(int sig_num);
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
RegisterExecutablePlatform(ExePlatformLaunch);
|
RegisterExecutablePlatform(ExePlatformLaunch);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
@ -168,7 +166,7 @@ int main(int argc, char *argv[]) {
|
|||||||
delete zone->second;
|
delete zone->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ bool Client::Process()
|
|||||||
OpcodeManager::EmuToName(app->GetOpcode()),
|
OpcodeManager::EmuToName(app->GetOpcode()),
|
||||||
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
||||||
app->Size(),
|
app->Size(),
|
||||||
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (m_client_status == cs_failed_to_login) {
|
if (m_client_status == cs_failed_to_login) {
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
LoginServer server;
|
LoginServer server;
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
bool run_server = true;
|
bool run_server = true;
|
||||||
Database database;
|
Database database;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
@ -157,21 +156,21 @@ int main(int argc, char **argv)
|
|||||||
LogInfo("Logging System Init");
|
LogInfo("Logging System Init");
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
// command handler
|
// command handler
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
|
|
||||||
LoadServerConfig();
|
LoadServerConfig();
|
||||||
LoadDatabaseConnection();
|
LoadDatabaseConnection();
|
||||||
|
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
LogSys.log_settings[Logs::Debug].log_to_console = static_cast<uint8>(Logs::General);
|
EQEmuLogSys::Instance()->log_settings[Logs::Debug].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
LogSys.log_settings[Logs::Debug].is_category_enabled = 1;
|
EQEmuLogSys::Instance()->log_settings[Logs::Debug].is_category_enabled = 1;
|
||||||
|
|
||||||
LoginserverCommandHandler::CommandHandler(argc, argv);
|
LoginserverCommandHandler::CommandHandler(argc, argv);
|
||||||
}
|
}
|
||||||
@ -180,7 +179,7 @@ int main(int argc, char **argv)
|
|||||||
LoadDatabaseConnection();
|
LoadDatabaseConnection();
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath("logs")
|
->SetLogPath("logs")
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|||||||
@ -29,7 +29,6 @@ LFGuildManager lfguildmanager;
|
|||||||
std::string WorldShortName;
|
std::string WorldShortName;
|
||||||
const queryservconfig *Config;
|
const queryservconfig *Config;
|
||||||
WorldServer *worldserver = 0;
|
WorldServer *worldserver = 0;
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
ZSList zs_list;
|
ZSList zs_list;
|
||||||
uint32 numzones = 0;
|
uint32 numzones = 0;
|
||||||
@ -42,7 +41,7 @@ void CatchSignal(int sig_num)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformQueryServ);
|
RegisterExecutablePlatform(ExePlatformQueryServ);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
Timer LFGuildExpireTimer(60000);
|
Timer LFGuildExpireTimer(60000);
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ int main()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
@ -183,7 +182,7 @@ int main()
|
|||||||
EQ::EventLoop::Get().Run();
|
EQ::EventLoop::Get().Run();
|
||||||
|
|
||||||
safe_delete(worldserver);
|
safe_delete(worldserver);
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateWindowTitle(char *iNewTitle)
|
void UpdateWindowTitle(char *iNewTitle)
|
||||||
|
|||||||
@ -79,7 +79,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
case ServerOP_ServerReloadRequest: {
|
case ServerOP_ServerReloadRequest: {
|
||||||
auto o = (ServerReload::Request*) p.Data();
|
auto o = (ServerReload::Request*) p.Data();
|
||||||
if (o->type == ServerReload::Type::Logs) {
|
if (o->type == ServerReload::Type::Logs) {
|
||||||
LogSys.LoadLogDatabaseSettings();
|
EQEmuLogSys::Instance()->LoadLogDatabaseSettings();
|
||||||
player_event_logs.ReloadSettings();
|
player_event_logs.ReloadSettings();
|
||||||
zs_list.SendPlayerEventLogSettings();
|
zs_list.SendPlayerEventLogSettings();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,6 @@
|
|||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
#include "../common/evolving_items.h"
|
#include "../common/evolving_items.h"
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
EvolvingItemsManager evolving_items_manager;
|
||||||
@ -79,7 +78,7 @@ inline bool MakeDirectory(const std::string &directory_name)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
@ -124,7 +123,7 @@ int main(int argc, char **argv)
|
|||||||
content_db.SetMySQL(database);
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
@ -242,6 +241,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,12 +34,11 @@
|
|||||||
#include "task_state_test.h"
|
#include "task_state_test.h"
|
||||||
|
|
||||||
const EQEmuConfig *Config;
|
const EQEmuConfig *Config;
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
||||||
|
|||||||
@ -651,7 +651,7 @@ void Clientlist::Process()
|
|||||||
OpcodeManager::EmuToName(app->GetOpcode()),
|
OpcodeManager::EmuToName(app->GetOpcode()),
|
||||||
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
||||||
app->Size(),
|
app->Size(),
|
||||||
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
||||||
);
|
);
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
|
|||||||
10
ucs/ucs.cpp
10
ucs/ucs.cpp
@ -44,7 +44,6 @@
|
|||||||
|
|
||||||
ChatChannelList *ChannelList;
|
ChatChannelList *ChannelList;
|
||||||
Clientlist *g_Clientlist;
|
Clientlist *g_Clientlist;
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
UCSDatabase database;
|
UCSDatabase database;
|
||||||
WorldServer *worldserver = nullptr;
|
WorldServer *worldserver = nullptr;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
@ -72,7 +71,7 @@ void Shutdown() {
|
|||||||
LogInfo("Shutting down...");
|
LogInfo("Shutting down...");
|
||||||
ChannelList->RemoveAllChannels();
|
ChannelList->RemoveAllChannels();
|
||||||
g_Clientlist->CloseAllConnections();
|
g_Clientlist->CloseAllConnections();
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
int caught_loop = 0;
|
int caught_loop = 0;
|
||||||
@ -87,7 +86,7 @@ void CatchSignal(int sig_num) {
|
|||||||
LogInfo("In a signal handler loop and process is incapable of exiting properly, forcefully cleaning up");
|
LogInfo("In a signal handler loop and process is incapable of exiting properly, forcefully cleaning up");
|
||||||
ChannelList->RemoveAllChannels();
|
ChannelList->RemoveAllChannels();
|
||||||
g_Clientlist->CloseAllConnections();
|
g_Clientlist->CloseAllConnections();
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
std::exit(0);
|
std::exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +100,7 @@ void PlayerEventQueueListener() {
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
RegisterExecutablePlatform(ExePlatformUCS);
|
RegisterExecutablePlatform(ExePlatformUCS);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
@ -136,7 +135,8 @@ int main() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()
|
||||||
|
->SetDatabase(&database)
|
||||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
|||||||
case ServerOP_ServerReloadRequest: {
|
case ServerOP_ServerReloadRequest: {
|
||||||
auto o = (ServerReload::Request*) pack->pBuffer;
|
auto o = (ServerReload::Request*) pack->pBuffer;
|
||||||
if (o->type == ServerReload::Type::Logs) {
|
if (o->type == ServerReload::Type::Logs) {
|
||||||
LogSys.LoadLogDatabaseSettings();
|
EQEmuLogSys::Instance()->LoadLogDatabaseSettings();
|
||||||
player_event_logs.ReloadSettings();
|
player_event_logs.ReloadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,12 +35,12 @@ if (scalar(@enum) > 0) {
|
|||||||
|
|
||||||
foreach my $cat (@cats) {
|
foreach my $cat (@cats) {
|
||||||
print "#define Log" . $cat . "(message, ...) do {\\
|
print "#define Log" . $cat . "(message, ...) do {\\
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::" . $cat . "))\\
|
if (EQEmuLogSys::Instance()->IsLogEnabled(Logs::General, Logs::" . $cat . "))\\
|
||||||
OutF(LogSys, Logs::General, Logs::" . $cat . ", __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\\
|
OutF(LogSys, Logs::General, Logs::" . $cat . ", __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define Log" . $cat . "Detail(message, ...) do {\\
|
#define Log" . $cat . "Detail(message, ...) do {\\
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::" . $cat . "))\\
|
if (EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::" . $cat . "))\\
|
||||||
OutF(LogSys, Logs::Detail, Logs::" . $cat . ", __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\\
|
OutF(LogSys, Logs::Detail, Logs::" . $cat . ", __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|||||||
@ -1100,7 +1100,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
|
|||||||
OpcodeManager::EmuToName(app->GetOpcode()),
|
OpcodeManager::EmuToName(app->GetOpcode()),
|
||||||
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
||||||
app->Size(),
|
app->Size(),
|
||||||
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!eqs->CheckState(ESTABLISHED)) {
|
if (!eqs->CheckState(ESTABLISHED)) {
|
||||||
|
|||||||
@ -104,7 +104,6 @@ volatile bool RunLoops = true;
|
|||||||
uint32 numclients = 0;
|
uint32 numclients = 0;
|
||||||
uint32 numzones = 0;
|
uint32 numzones = 0;
|
||||||
const WorldConfig *Config;
|
const WorldConfig *Config;
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
WebInterfaceList web_interface;
|
WebInterfaceList web_interface;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
@ -130,7 +129,7 @@ inline void UpdateWindowTitle(std::string new_title)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformWorld);
|
RegisterExecutablePlatform(ExePlatformWorld);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
if (WorldBoot::HandleCommandInput(argc, argv)) {
|
if (WorldBoot::HandleCommandInput(argc, argv)) {
|
||||||
@ -504,7 +503,7 @@ int main(int argc, char **argv)
|
|||||||
zoneserver_list.KillAll();
|
zoneserver_list.KillAll();
|
||||||
LogInfo("Zone (TCP) listener stopped");
|
LogInfo("Zone (TCP) listener stopped");
|
||||||
LogInfo("Signaling HTTP service to stop");
|
LogInfo("Signaling HTTP service to stop");
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
WorldBoot::Shutdown();
|
WorldBoot::Shutdown();
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, const char *f
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccountStatus::QuestTroupe,
|
AccountStatus::QuestTroupe,
|
||||||
LogSys.GetGMSayColorFromCategory(log_category),
|
EQEmuLogSys::Instance()->GetGMSayColorFromCategory(log_category),
|
||||||
fmt::format(
|
fmt::format(
|
||||||
" {}{}",
|
" {}{}",
|
||||||
(iter == 0 ? " ---" : ""),
|
(iter == 0 ? " ---" : ""),
|
||||||
@ -73,7 +73,7 @@ void WorldBoot::GMSayHookCallBackProcessWorld(uint16 log_category, const char *f
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccountStatus::QuestTroupe,
|
AccountStatus::QuestTroupe,
|
||||||
LogSys.GetGMSayColorFromCategory(log_category),
|
EQEmuLogSys::Instance()->GetGMSayColorFromCategory(log_category),
|
||||||
"%s",
|
"%s",
|
||||||
fmt::format("[{}] [{}] {}", Logs::LogCategoryName[log_category], func, message).c_str()
|
fmt::format("[{}] [{}] {}", Logs::LogCategoryName[log_category], func, message).c_str()
|
||||||
);
|
);
|
||||||
@ -83,12 +83,12 @@ bool WorldBoot::HandleCommandInput(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// command handler
|
// command handler
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
WorldConfig::LoadConfig();
|
WorldConfig::LoadConfig();
|
||||||
LoadDatabaseConnections();
|
LoadDatabaseConnections();
|
||||||
RuleManager::Instance()->LoadRules(&database, "default", false);
|
RuleManager::Instance()->LoadRules(&database, "default", false);
|
||||||
LogSys.EnableConsoleLogging();
|
EQEmuLogSys::Instance()->EnableConsoleLogging();
|
||||||
WorldserverCLI::CommandHandler(argc, argv);
|
WorldserverCLI::CommandHandler(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,11 +231,11 @@ extern WorldEventScheduler event_scheduler;
|
|||||||
bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// logging system init
|
// logging system init
|
||||||
auto logging = LogSys.SetDatabase(&database)
|
auto logging = EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings();
|
->LoadLogDatabaseSettings();
|
||||||
|
|
||||||
LogSys.SetDiscordHandler(&WorldBoot::DiscordWebhookMessageHandler);
|
EQEmuLogSys::Instance()->SetDiscordHandler(&WorldBoot::DiscordWebhookMessageHandler);
|
||||||
|
|
||||||
const auto c = EQEmuConfig::get();
|
const auto c = EQEmuConfig::get();
|
||||||
if (c->auto_database_updates) {
|
if (c->auto_database_updates) {
|
||||||
|
|||||||
@ -983,7 +983,7 @@ void ZSList::SendServerReload(ServerReload::Type type, uchar *packet)
|
|||||||
} else if (type == ServerReload::Type::ContentFlags) {
|
} else if (type == ServerReload::Type::ContentFlags) {
|
||||||
content_service.SetExpansionContext()->ReloadContentFlags();
|
content_service.SetExpansionContext()->ReloadContentFlags();
|
||||||
} else if (type == ServerReload::Type::Logs) {
|
} else if (type == ServerReload::Type::Logs) {
|
||||||
LogSys.LoadLogDatabaseSettings();
|
EQEmuLogSys::Instance()->LoadLogDatabaseSettings();
|
||||||
player_event_logs.ReloadSettings();
|
player_event_logs.ReloadSettings();
|
||||||
UCSLink.SendPacket(&pack);
|
UCSLink.SendPacket(&pack);
|
||||||
QSLink.SendPacket(&pack);
|
QSLink.SendPacket(&pack);
|
||||||
|
|||||||
@ -835,9 +835,9 @@ Json::Value ApiGetLogsysCategories(EQ::Net::WebsocketServerConnection *connectio
|
|||||||
|
|
||||||
row["log_category_id"] = i;
|
row["log_category_id"] = i;
|
||||||
row["log_category_description"] = Logs::LogCategoryName[i];
|
row["log_category_description"] = Logs::LogCategoryName[i];
|
||||||
row["log_to_console"] = LogSys.log_settings[i].log_to_console;
|
row["log_to_console"] = EQEmuLogSys::Instance()->log_settings[i].log_to_console;
|
||||||
row["log_to_file"] = LogSys.log_settings[i].log_to_file;
|
row["log_to_file"] = EQEmuLogSys::Instance()->log_settings[i].log_to_file;
|
||||||
row["log_to_gmsay"] = LogSys.log_settings[i].log_to_gmsay;
|
row["log_to_gmsay"] = EQEmuLogSys::Instance()->log_settings[i].log_to_gmsay;
|
||||||
|
|
||||||
response.append(row);
|
response.append(row);
|
||||||
}
|
}
|
||||||
@ -866,15 +866,15 @@ Json::Value ApiSetLoggingLevel(EQ::Net::WebsocketServerConnection *connection, J
|
|||||||
if (logging_category < Logs::LogCategory::MaxCategoryID &&
|
if (logging_category < Logs::LogCategory::MaxCategoryID &&
|
||||||
logging_category > Logs::LogCategory::None
|
logging_category > Logs::LogCategory::None
|
||||||
) {
|
) {
|
||||||
LogSys.log_settings[logging_category].log_to_console = logging_level;
|
EQEmuLogSys::Instance()->log_settings[logging_category].log_to_console = logging_level;
|
||||||
response["status"] = "Category log level updated";
|
response["status"] = "Category log level updated";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logging_level > 0) {
|
if (logging_level > 0) {
|
||||||
LogSys.log_settings[logging_category].is_category_enabled = 1;
|
EQEmuLogSys::Instance()->log_settings[logging_category].is_category_enabled = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogSys.log_settings[logging_category].is_category_enabled = 0;
|
EQEmuLogSys::Instance()->log_settings[logging_category].is_category_enabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@ -882,7 +882,7 @@ Json::Value ApiSetLoggingLevel(EQ::Net::WebsocketServerConnection *connection, J
|
|||||||
|
|
||||||
void RegisterApiLogEvent(std::unique_ptr<EQ::Net::WebsocketServer> &server)
|
void RegisterApiLogEvent(std::unique_ptr<EQ::Net::WebsocketServer> &server)
|
||||||
{
|
{
|
||||||
LogSys.SetConsoleHandler(
|
EQEmuLogSys::Instance()->SetConsoleHandler(
|
||||||
[&](uint16 log_category, const std::string &msg) {
|
[&](uint16 log_category, const std::string &msg) {
|
||||||
Json::Value data;
|
Json::Value data;
|
||||||
data["log_category"] = log_category;
|
data["log_category"] = log_category;
|
||||||
|
|||||||
@ -278,7 +278,7 @@ void ZoneCLI::BenchmarkDatabuckets(int argc, char **argv, argh::parser &cmd, std
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (std::getenv("DEBUG")) {
|
if (std::getenv("DEBUG")) {
|
||||||
LogSys.SetDatabase(&database)->LoadLogDatabaseSettings();
|
EQEmuLogSys::Instance()->SetDatabase(&database)->LoadLogDatabaseSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto start_time = std::chrono::high_resolution_clock::now();
|
auto start_time = std::chrono::high_resolution_clock::now();
|
||||||
|
|||||||
@ -41,11 +41,11 @@ inline void RunTest(const std::string &test_name, int expected, int actual)
|
|||||||
extern Zone *zone;
|
extern Zone *zone;
|
||||||
|
|
||||||
inline void SetupZone(std::string zone_short_name, uint32 instance_id = 0) {
|
inline void SetupZone(std::string zone_short_name, uint32 instance_id = 0) {
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
|
|
||||||
LogSys.log_settings[Logs::ZoneState].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::ZoneState].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
||||||
LogSys.log_settings[Logs::Info].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::Info].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
||||||
LogSys.log_settings[Logs::Spawns].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::Spawns].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
||||||
|
|
||||||
// boot shell zone for testing
|
// boot shell zone for testing
|
||||||
Zone::Bootup(ZoneID(zone_short_name), 0, false);
|
Zone::Bootup(ZoneID(zone_short_name), 0, false);
|
||||||
@ -53,5 +53,5 @@ inline void SetupZone(std::string zone_short_name, uint32 instance_id = 0) {
|
|||||||
entity_list.Process();
|
entity_list.Process();
|
||||||
entity_list.MobProcess();
|
entity_list.MobProcess();
|
||||||
|
|
||||||
LogSys.EnableConsoleLogging();
|
EQEmuLogSys::Instance()->EnableConsoleLogging();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ void ZoneCLI::TestDataBuckets(int argc, char** argv, argh::parser& cmd, std::str
|
|||||||
uint32 break_length = 50;
|
uint32 break_length = 50;
|
||||||
int failed_count = 0;
|
int failed_count = 0;
|
||||||
|
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
|
|
||||||
// boot shell zone for testing
|
// boot shell zone for testing
|
||||||
Zone::Bootup(ZoneID("qrg"), 0, false);
|
Zone::Bootup(ZoneID("qrg"), 0, false);
|
||||||
@ -25,13 +25,13 @@ void ZoneCLI::TestDataBuckets(int argc, char** argv, argh::parser& cmd, std::str
|
|||||||
entity_list.Process();
|
entity_list.Process();
|
||||||
entity_list.MobProcess();
|
entity_list.MobProcess();
|
||||||
|
|
||||||
|
EQEmuLogSys::Instance()->EnableConsoleLogging();
|
||||||
|
|
||||||
Client* client = new Client();
|
Client* client = new Client();
|
||||||
client->SetCharacterId(1); // Set a dummy character ID for testing
|
client->SetCharacterId(1); // Set a dummy character ID for testing
|
||||||
|
|
||||||
LogSys.EnableConsoleLogging();
|
EQEmuLogSys::Instance()->log_settings[Logs::MySQLQuery].is_category_enabled = std::getenv("DEBUG") ? 1 : 0;
|
||||||
|
EQEmuLogSys::Instance()->log_settings[Logs::MySQLQuery].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
||||||
LogSys.log_settings[Logs::MySQLQuery].is_category_enabled = std::getenv("DEBUG") ? 1 : 0;
|
|
||||||
LogSys.log_settings[Logs::MySQLQuery].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
|
||||||
|
|
||||||
// 🧹 Delete all test keys before running tests
|
// 🧹 Delete all test keys before running tests
|
||||||
std::vector<std::string> test_keys_to_clear = {
|
std::vector<std::string> test_keys_to_clear = {
|
||||||
|
|||||||
@ -68,7 +68,7 @@ void ZoneCLI::TestNpcHandins(int argc, char **argv, argh::parser &cmd, std::stri
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
|
|
||||||
Zone::Bootup(ZoneID("qrg"), 0, false);
|
Zone::Bootup(ZoneID("qrg"), 0, false);
|
||||||
zone->StopShutdownTimer();
|
zone->StopShutdownTimer();
|
||||||
@ -426,10 +426,10 @@ void ZoneCLI::TestNpcHandins(int argc, char **argv, argh::parser &cmd, std::stri
|
|||||||
std::map<std::string, uint32> required;
|
std::map<std::string, uint32> required;
|
||||||
std::vector<EQ::ItemInstance *> items;
|
std::vector<EQ::ItemInstance *> items;
|
||||||
|
|
||||||
LogSys.EnableConsoleLogging();
|
EQEmuLogSys::Instance()->EnableConsoleLogging();
|
||||||
|
|
||||||
// turn this on to see debugging output
|
// turn this on to see debugging output
|
||||||
LogSys.log_settings[Logs::NpcHandin].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::NpcHandin].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
||||||
|
|
||||||
for (auto &test: test_cases) {
|
for (auto &test: test_cases) {
|
||||||
hand_ins.clear();
|
hand_ins.clear();
|
||||||
@ -524,7 +524,7 @@ void ZoneCLI::TestNpcHandins(int argc, char **argv, argh::parser &cmd, std::stri
|
|||||||
|
|
||||||
npc->ResetHandin();
|
npc->ResetHandin();
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::NpcHandin].log_to_console > 0) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::NpcHandin].log_to_console > 0) {
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ void ZoneCLI::TestNpcHandinsMultiQuest(int argc, char **argv, argh::parser &cmd,
|
|||||||
uint32 break_length = 50;
|
uint32 break_length = 50;
|
||||||
int failed_count = 0;
|
int failed_count = 0;
|
||||||
|
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
|
|
||||||
Zone::Bootup(ZoneID("qrg"), 0, false);
|
Zone::Bootup(ZoneID("qrg"), 0, false);
|
||||||
zone->StopShutdownTimer();
|
zone->StopShutdownTimer();
|
||||||
@ -93,10 +93,10 @@ void ZoneCLI::TestNpcHandinsMultiQuest(int argc, char **argv, argh::parser &cmd,
|
|||||||
std::map<std::string, uint32> required;
|
std::map<std::string, uint32> required;
|
||||||
std::vector<EQ::ItemInstance *> items;
|
std::vector<EQ::ItemInstance *> items;
|
||||||
|
|
||||||
LogSys.EnableConsoleLogging();
|
EQEmuLogSys::Instance()->EnableConsoleLogging();
|
||||||
|
|
||||||
// turn this on to see debugging output
|
// turn this on to see debugging output
|
||||||
LogSys.log_settings[Logs::NpcHandin].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::NpcHandin].log_to_console = std::getenv("DEBUG") ? 3 : 0;
|
||||||
|
|
||||||
for (auto &test: test_cases) {
|
for (auto &test: test_cases) {
|
||||||
required.clear();
|
required.clear();
|
||||||
@ -162,7 +162,7 @@ void ZoneCLI::TestNpcHandinsMultiQuest(int argc, char **argv, argh::parser &cmd,
|
|||||||
|
|
||||||
npc->ResetHandin();
|
npc->ResetHandin();
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::NpcHandin].log_to_console > 0) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::NpcHandin].log_to_console > 0) {
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -463,7 +463,7 @@ int Client::HandlePacket(const EQApplicationPacket *app)
|
|||||||
OpcodeManager::EmuToName(app->GetOpcode()),
|
OpcodeManager::EmuToName(app->GetOpcode()),
|
||||||
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
|
||||||
app->Size(),
|
app->Size(),
|
||||||
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
|
||||||
);
|
);
|
||||||
|
|
||||||
EmuOpcode opcode = app->GetOpcode();
|
EmuOpcode opcode = app->GetOpcode();
|
||||||
@ -5533,7 +5533,7 @@ void Client::Handle_OP_CrashDump(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
void Client::Handle_OP_CreateObject(const EQApplicationPacket *app)
|
void Client::Handle_OP_CreateObject(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if (LogSys.log_settings[Logs::Inventory].is_category_enabled)
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Inventory].is_category_enabled)
|
||||||
LogInventory("Handle_OP_CreateObject() [psize: [{}]] [{}]", app->size, DumpPacketToString(app).c_str());
|
LogInventory("Handle_OP_CreateObject() [psize: [{}]] [{}]", app->size, DumpPacketToString(app).c_str());
|
||||||
|
|
||||||
DropItem(EQ::invslot::slotCursor);
|
DropItem(EQ::invslot::slotCursor);
|
||||||
|
|||||||
@ -76,7 +76,7 @@ void command_logs(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::vector<std::string> gmsay;
|
std::vector<std::string> gmsay;
|
||||||
for (int i = 0; i <= 2; i++) {
|
for (int i = 0; i <= 2; i++) {
|
||||||
if (LogSys.log_settings[index].log_to_gmsay == i) {
|
if (EQEmuLogSys::Instance()->log_settings[index].log_to_gmsay == i) {
|
||||||
gmsay.emplace_back(std::to_string(i));
|
gmsay.emplace_back(std::to_string(i));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ void command_logs(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::vector<std::string> file;
|
std::vector<std::string> file;
|
||||||
for (int i = 0; i <= 2; i++) {
|
for (int i = 0; i <= 2; i++) {
|
||||||
if (LogSys.log_settings[index].log_to_file == i) {
|
if (EQEmuLogSys::Instance()->log_settings[index].log_to_file == i) {
|
||||||
file.emplace_back(std::to_string(i));
|
file.emplace_back(std::to_string(i));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ void command_logs(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::vector<std::string> console;
|
std::vector<std::string> console;
|
||||||
for (int i = 0; i <= 2; i++) {
|
for (int i = 0; i <= 2; i++) {
|
||||||
if (LogSys.log_settings[index].log_to_console == i) {
|
if (EQEmuLogSys::Instance()->log_settings[index].log_to_console == i) {
|
||||||
console.emplace_back(std::to_string(i));
|
console.emplace_back(std::to_string(i));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ void command_logs(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::vector<std::string> discord;
|
std::vector<std::string> discord;
|
||||||
for (int i = 0; i <= 2; i++) {
|
for (int i = 0; i <= 2; i++) {
|
||||||
if (LogSys.log_settings[index].log_to_discord == i) {
|
if (EQEmuLogSys::Instance()->log_settings[index].log_to_discord == i) {
|
||||||
discord.emplace_back(std::to_string(i));
|
discord.emplace_back(std::to_string(i));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -206,16 +206,16 @@ void command_logs(Client *c, const Seperator *sep)
|
|||||||
auto setting = Strings::ToUnsignedInt(sep->arg[4]);
|
auto setting = Strings::ToUnsignedInt(sep->arg[4]);
|
||||||
|
|
||||||
if (is_console) {
|
if (is_console) {
|
||||||
LogSys.log_settings[category_id].log_to_console = setting;
|
EQEmuLogSys::Instance()->log_settings[category_id].log_to_console = setting;
|
||||||
}
|
}
|
||||||
else if (is_file) {
|
else if (is_file) {
|
||||||
LogSys.log_settings[category_id].log_to_file = setting;
|
EQEmuLogSys::Instance()->log_settings[category_id].log_to_file = setting;
|
||||||
}
|
}
|
||||||
else if (is_gmsay) {
|
else if (is_gmsay) {
|
||||||
LogSys.log_settings[category_id].log_to_gmsay = setting;
|
EQEmuLogSys::Instance()->log_settings[category_id].log_to_gmsay = setting;
|
||||||
}
|
}
|
||||||
else if (is_discord) {
|
else if (is_discord) {
|
||||||
LogSys.log_settings[category_id].log_to_discord = setting;
|
EQEmuLogSys::Instance()->log_settings[category_id].log_to_discord = setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logs_set) {
|
if (logs_set) {
|
||||||
@ -231,7 +231,7 @@ void command_logs(Client *c, const Seperator *sep)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.log_settings[category_id].is_category_enabled = setting ? 1 : 0;
|
EQEmuLogSys::Instance()->log_settings[category_id].is_category_enabled = setting ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,9 +14,9 @@ void command_lootsim(Client *c, const Seperator *sep)
|
|||||||
auto log_enabled = arguments > 3 ? Strings::ToUnsignedInt(sep->arg[4]) : false;
|
auto log_enabled = arguments > 3 ? Strings::ToUnsignedInt(sep->arg[4]) : false;
|
||||||
|
|
||||||
// temporarily disable loot logging unless set explicitly
|
// temporarily disable loot logging unless set explicitly
|
||||||
LogSys.log_settings[Logs::Loot].log_to_console = log_enabled ? LogSys.log_settings[Logs::Loot].log_to_console : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::Loot].log_to_console = log_enabled ? EQEmuLogSys::Instance()->log_settings[Logs::Loot].log_to_console : 0;
|
||||||
LogSys.log_settings[Logs::Loot].log_to_file = log_enabled ? LogSys.log_settings[Logs::Loot].log_to_file : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::Loot].log_to_file = log_enabled ? EQEmuLogSys::Instance()->log_settings[Logs::Loot].log_to_file : 0;
|
||||||
LogSys.log_settings[Logs::Loot].log_to_gmsay = log_enabled ? LogSys.log_settings[Logs::Loot].log_to_gmsay : 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::Loot].log_to_gmsay = log_enabled ? EQEmuLogSys::Instance()->log_settings[Logs::Loot].log_to_gmsay : 0;
|
||||||
|
|
||||||
auto npc_type = content_db.LoadNPCTypesData(npc_id);
|
auto npc_type = content_db.LoadNPCTypesData(npc_id);
|
||||||
if (npc_type) {
|
if (npc_type) {
|
||||||
@ -182,7 +182,7 @@ void command_lootsim(Client *c, const Seperator *sep)
|
|||||||
);
|
);
|
||||||
c->SendChatLineBreak();
|
c->SendChatLineBreak();
|
||||||
|
|
||||||
LogSys.LoadLogDatabaseSettings();
|
EQEmuLogSys::Instance()->LoadLogDatabaseSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -688,7 +688,7 @@ void Client::DropItem(int16 slot_id, bool recurse)
|
|||||||
LogInventory("Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
|
LogInventory("Error in InventoryProfile::CheckNoDrop() - returned 'true' for empty slot");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (LogSys.log_settings[Logs::Inventory].is_category_enabled) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Inventory].is_category_enabled) {
|
||||||
LogInventory("DropItem() Hack detected - full item parse:");
|
LogInventory("DropItem() Hack detected - full item parse:");
|
||||||
LogInventory("depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
LogInventory("depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||||
(invalid_drop->GetItem() ? invalid_drop->GetItem()->Name : "null data"), invalid_drop->GetID(), (invalid_drop->IsDroppable(false) ? "true" : "false"));
|
(invalid_drop->GetItem() ? invalid_drop->GetItem()->Name : "null data"), invalid_drop->GetID(), (invalid_drop->IsDroppable(false) ? "true" : "false"));
|
||||||
@ -720,7 +720,7 @@ void Client::DropItem(int16 slot_id, bool recurse)
|
|||||||
// Take control of item in client inventory
|
// Take control of item in client inventory
|
||||||
auto* inst = m_inv.PopItem(slot_id);
|
auto* inst = m_inv.PopItem(slot_id);
|
||||||
if (inst) {
|
if (inst) {
|
||||||
if (LogSys.log_settings[Logs::Inventory].is_category_enabled) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Inventory].is_category_enabled) {
|
||||||
LogInventory("DropItem() Processing - full item parse:");
|
LogInventory("DropItem() Processing - full item parse:");
|
||||||
LogInventory(
|
LogInventory(
|
||||||
"depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
"depth: 0, Item: [{}] (id: [{}]), IsDroppable: [{}]",
|
||||||
|
|||||||
@ -292,7 +292,7 @@ void NPC::AddLootDrop(
|
|||||||
|
|
||||||
auto item = new LootItem;
|
auto item = new LootItem;
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Loot].is_category_enabled == 1) {
|
||||||
EQ::SayLinkEngine linker;
|
EQ::SayLinkEngine linker;
|
||||||
linker.SetLinkType(EQ::saylink::SayLinkItemData);
|
linker.SetLinkType(EQ::saylink::SayLinkItemData);
|
||||||
linker.SetItemData(item2);
|
linker.SetItemData(item2);
|
||||||
|
|||||||
@ -102,7 +102,6 @@ TitleManager title_manager;
|
|||||||
QueryServ *QServ = 0;
|
QueryServ *QServ = 0;
|
||||||
NpcScaleManager *npc_scale_manager;
|
NpcScaleManager *npc_scale_manager;
|
||||||
QuestParserCollection *parse = 0;
|
QuestParserCollection *parse = 0;
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
ZoneEventScheduler event_scheduler;
|
ZoneEventScheduler event_scheduler;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
@ -123,13 +122,13 @@ bool CheckForCompatibleQuestPlugins();
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformZone);
|
RegisterExecutablePlatform(ExePlatformZone);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
|
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
// silence logging if we ran a command
|
// silence logging if we ran a command
|
||||||
if (ZoneCLI::RanConsoleCommand(argc, argv) || ZoneCLI::RanTestCommand(argc, argv)) {
|
if (ZoneCLI::RanConsoleCommand(argc, argv) || ZoneCLI::RanTestCommand(argc, argv)) {
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
PathManager::Instance()->Init();
|
PathManager::Instance()->Init();
|
||||||
@ -295,18 +294,18 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// command handler (no sidecar or test commands)
|
// command handler (no sidecar or test commands)
|
||||||
if (ZoneCLI::RanConsoleCommand(argc, argv) && !(ZoneCLI::RanSidecarCommand(argc, argv) || ZoneCLI::RanTestCommand(argc, argv))) {
|
if (ZoneCLI::RanConsoleCommand(argc, argv) && !(ZoneCLI::RanSidecarCommand(argc, argv) || ZoneCLI::RanTestCommand(argc, argv))) {
|
||||||
LogSys.EnableConsoleLogging();
|
EQEmuLogSys::Instance()->EnableConsoleLogging();
|
||||||
ZoneCLI::CommandHandler(argc, argv);
|
ZoneCLI::CommandHandler(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings(ZoneCLI::RanTestCommand(argc, argv))
|
->LoadLogDatabaseSettings(ZoneCLI::RanTestCommand(argc, argv))
|
||||||
->SetGMSayHandler(&Zone::GMSayHookCallBackProcess)
|
->SetGMSayHandler(&Zone::GMSayHookCallBackProcess)
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
if (ZoneCLI::RanTestCommand(argc, argv)) {
|
if (ZoneCLI::RanTestCommand(argc, argv)) {
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
player_event_logs.SetDatabase(&database)->Init();
|
player_event_logs.SetDatabase(&database)->Init();
|
||||||
@ -489,7 +488,7 @@ int main(int argc, char **argv)
|
|||||||
// sidecar command handler
|
// sidecar command handler
|
||||||
if (ZoneCLI::RanConsoleCommand(argc, argv)
|
if (ZoneCLI::RanConsoleCommand(argc, argv)
|
||||||
&& (ZoneCLI::RanSidecarCommand(argc, argv) || ZoneCLI::RanTestCommand(argc, argv))) {
|
&& (ZoneCLI::RanSidecarCommand(argc, argv) || ZoneCLI::RanTestCommand(argc, argv))) {
|
||||||
LogSys.EnableConsoleLogging();
|
EQEmuLogSys::Instance()->EnableConsoleLogging();
|
||||||
ZoneCLI::CommandHandler(argc, argv);
|
ZoneCLI::CommandHandler(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,7 +680,7 @@ int main(int argc, char **argv)
|
|||||||
bot_command_deinit();
|
bot_command_deinit();
|
||||||
safe_delete(parse);
|
safe_delete(parse);
|
||||||
LogInfo("Proper zone shutdown complete.");
|
LogInfo("Proper zone shutdown complete.");
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
safe_delete(mutex);
|
safe_delete(mutex);
|
||||||
safe_delete(QServ);
|
safe_delete(QServ);
|
||||||
@ -693,7 +692,7 @@ void Shutdown()
|
|||||||
{
|
{
|
||||||
zone->Shutdown(true);
|
zone->Shutdown(true);
|
||||||
LogInfo("Shutting down...");
|
LogInfo("Shutting down...");
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
EQ::EventLoop::Get().Shutdown();
|
EQ::EventLoop::Get().Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -187,7 +187,7 @@ void NpcScaleManager::ScaleNPC(
|
|||||||
npc->ModifyNPCStat("special_abilities", scale_data.special_abilities);
|
npc->ModifyNPCStat("special_abilities", scale_data.special_abilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::NPCScaling].is_category_enabled == 1) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::NPCScaling].is_category_enabled == 1) {
|
||||||
std::string scale_log;
|
std::string scale_log;
|
||||||
|
|
||||||
for (const auto &stat : scaling_stats) {
|
for (const auto &stat : scaling_stats) {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ void SidecarApi::LootSimulatorController(const httplib::Request &req, httplib::R
|
|||||||
auto iterations = 100;
|
auto iterations = 100;
|
||||||
auto log_enabled = false;
|
auto log_enabled = false;
|
||||||
|
|
||||||
LogSys.log_settings[Logs::Loot].log_to_console = 0;
|
EQEmuLogSys::Instance()->log_settings[Logs::Loot].log_to_console = 0;
|
||||||
|
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
|
|
||||||
|
|||||||
@ -229,7 +229,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
LogInfo("World assigned Port [{}] for this zone", sci->port);
|
LogInfo("World assigned Port [{}] for this zone", sci->port);
|
||||||
ZoneConfig::SetZonePort(sci->port);
|
ZoneConfig::SetZonePort(sci->port);
|
||||||
|
|
||||||
LogSys.SetDiscordHandler(&Zone::DiscordWebhookMessageHandler);
|
EQEmuLogSys::Instance()->SetDiscordHandler(&Zone::DiscordWebhookMessageHandler);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4589,7 +4589,8 @@ void WorldServer::ProcessReload(const ServerReload::Request& request)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ServerReload::Type::Logs:
|
case ServerReload::Type::Logs:
|
||||||
LogSys.LoadLogDatabaseSettings();
|
EQEmuLogSys::Instance()->LoadLogDatabaseSettings();
|
||||||
|
player_event_logs.ReloadSettings();
|
||||||
// if QS process is enabled, we get settings from QS
|
// if QS process is enabled, we get settings from QS
|
||||||
if (!RuleB(Logging, PlayerEventsQSProcess)) {
|
if (!RuleB(Logging, PlayerEventsQSProcess)) {
|
||||||
player_event_logs.ReloadSettings();
|
player_event_logs.ReloadSettings();
|
||||||
|
|||||||
@ -175,7 +175,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool is_static) {
|
|||||||
/*
|
/*
|
||||||
* Set Logging
|
* Set Logging
|
||||||
*/
|
*/
|
||||||
LogSys.StartFileLogs(StringFormat("%s_version_%u_inst_id_%u_port_%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort));
|
EQEmuLogSys::Instance()->StartFileLogs(StringFormat("%s_version_%u_inst_id_%u_port_%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -943,7 +943,7 @@ void Zone::Shutdown(bool quiet)
|
|||||||
parse->ReloadQuests(true);
|
parse->ReloadQuests(true);
|
||||||
UpdateWindowTitle(nullptr);
|
UpdateWindowTitle(nullptr);
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
if (RuleB(Zone, KillProcessOnDynamicShutdown)) {
|
if (RuleB(Zone, KillProcessOnDynamicShutdown)) {
|
||||||
LogInfo("Shutting down");
|
LogInfo("Shutting down");
|
||||||
@ -1241,9 +1241,9 @@ bool Zone::Init(bool is_static) {
|
|||||||
LogInfo("Zone booted successfully zone_id [{}] time_offset [{}]", zoneid, zone_time.getEQTimeZone());
|
LogInfo("Zone booted successfully zone_id [{}] time_offset [{}]", zoneid, zone_time.getEQTimeZone());
|
||||||
|
|
||||||
// logging origination information
|
// logging origination information
|
||||||
LogSys.origination_info.zone_short_name = zone->short_name;
|
EQEmuLogSys::Instance()->origination_info.zone_short_name = zone->short_name;
|
||||||
LogSys.origination_info.zone_long_name = zone->long_name;
|
EQEmuLogSys::Instance()->origination_info.zone_long_name = zone->long_name;
|
||||||
LogSys.origination_info.instance_id = zone->instanceid;
|
EQEmuLogSys::Instance()->origination_info.instance_id = zone->instanceid;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2865,7 +2865,7 @@ void Zone::SendDiscordMessage(const std::string& webhook_name, const std::string
|
|||||||
bool not_found = true;
|
bool not_found = true;
|
||||||
|
|
||||||
for (int i= 0; i < MAX_DISCORD_WEBHOOK_ID; i++) {
|
for (int i= 0; i < MAX_DISCORD_WEBHOOK_ID; i++) {
|
||||||
auto &w = LogSys.GetDiscordWebhooks()[i];
|
auto &w = EQEmuLogSys::Instance()->GetDiscordWebhooks()[i];
|
||||||
if (w.webhook_name == webhook_name) {
|
if (w.webhook_name == webhook_name) {
|
||||||
SendDiscordMessage(w.id, message + "\n");
|
SendDiscordMessage(w.id, message + "\n");
|
||||||
not_found = false;
|
not_found = false;
|
||||||
|
|||||||
10
zone/zone.h
10
zone/zone.h
@ -387,7 +387,7 @@ public:
|
|||||||
entity_list.MessageStatus(
|
entity_list.MessageStatus(
|
||||||
0,
|
0,
|
||||||
AccountStatus::QuestTroupe,
|
AccountStatus::QuestTroupe,
|
||||||
LogSys.GetGMSayColorFromCategory(log_category),
|
EQEmuLogSys::Instance()->GetGMSayColorFromCategory(log_category),
|
||||||
message_split[0].c_str()
|
message_split[0].c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ public:
|
|||||||
entity_list.MessageStatus(
|
entity_list.MessageStatus(
|
||||||
0,
|
0,
|
||||||
AccountStatus::QuestTroupe,
|
AccountStatus::QuestTroupe,
|
||||||
LogSys.GetGMSayColorFromCategory(log_category),
|
EQEmuLogSys::Instance()->GetGMSayColorFromCategory(log_category),
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"--- {}",
|
"--- {}",
|
||||||
message_split[iter]
|
message_split[iter]
|
||||||
@ -407,7 +407,7 @@ public:
|
|||||||
entity_list.MessageStatus(
|
entity_list.MessageStatus(
|
||||||
0,
|
0,
|
||||||
AccountStatus::QuestTroupe,
|
AccountStatus::QuestTroupe,
|
||||||
LogSys.GetGMSayColorFromCategory(log_category),
|
EQEmuLogSys::Instance()->GetGMSayColorFromCategory(log_category),
|
||||||
fmt::format("[{}] [{}] {}", Logs::LogCategoryName[log_category], func, message).c_str()
|
fmt::format("[{}] [{}] {}", Logs::LogCategoryName[log_category], func, message).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -418,11 +418,11 @@ public:
|
|||||||
static void DiscordWebhookMessageHandler(uint16 log_category, int webhook_id, const std::string &message)
|
static void DiscordWebhookMessageHandler(uint16 log_category, int webhook_id, const std::string &message)
|
||||||
{
|
{
|
||||||
std::string message_prefix;
|
std::string message_prefix;
|
||||||
if (!LogSys.origination_info.zone_short_name.empty()) {
|
if (!EQEmuLogSys::Instance()->origination_info.zone_short_name.empty()) {
|
||||||
message_prefix = fmt::format(
|
message_prefix = fmt::format(
|
||||||
"[**{}**] **Zone** [**{}**] ",
|
"[**{}**] **Zone** [**{}**] ",
|
||||||
Logs::LogCategoryName[log_category],
|
Logs::LogCategoryName[log_category],
|
||||||
LogSys.origination_info.zone_short_name
|
EQEmuLogSys::Instance()->origination_info.zone_short_name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user