mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-05 11:26:35 +00:00
[Logging] Logging Improvements (#2755)
* Console logging improvements * stderr handling * Add origination information * Formatting * Update zoneserver.cpp * Update eqemu_logsys.cpp * Remove semicolon from MySQLQuery log output * Remove IsRfc5424LogCategory * Remove no longer used functions * Remove definition BUILD_LOGGING * Deprecate categories UCSServer & WorldServer * Deprecate UCS / World Server / Zone Server categories * Deprecate Status, QSServer, Normal * Update login_server.cpp * Deprecate Emergency, Alert, Critical, Notice * Deprecate Alert * Fix terminal color resetting * Deprecate headless client * Move LogAIModerate to Detail * Deprecate moderate logging level for detail * Update logs.cpp * Logs list simplify * Update logs.cpp * Add discord to log command * Remove unused headers * Windows fix * Error in world when zones fail to load * Show warning color properly * Keep loginserver thread log from colliding with other logs during startup * Deprecate Loginserver category
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
#include "../../common/zone_store.h"
|
||||
#include "../../common/termcolor/rang.hpp"
|
||||
|
||||
void WorldserverCLI::TestColors(int argc, char **argv, argh::parser &cmd, std::string &description)
|
||||
{
|
||||
description = "Test command";
|
||||
|
||||
if (cmd[{"-h", "--help"}]) {
|
||||
return;
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
using namespace rang;
|
||||
|
||||
// Because rang use static values it means that all redirections should be done
|
||||
// before calling rang functions.
|
||||
|
||||
// Visual test for background colors
|
||||
cout << bg::green
|
||||
<< "This text has green background." << bg::reset << endl
|
||||
<< bg::red << "This text has red background." << bg::reset << endl
|
||||
<< bg::black << "This text has black background." << bg::reset << endl
|
||||
<< bg::yellow << "This text has yellow background." << bg::reset
|
||||
<< endl
|
||||
<< bg::blue << "This text has blue background." << bg::reset << endl
|
||||
<< bg::magenta << "This text has magenta background." << bg::reset
|
||||
<< endl
|
||||
<< bg::cyan << "This text has cyan background." << bg::reset << endl
|
||||
<< bg::gray << fg::black << "This text has gray background."
|
||||
<< bg::reset << style::reset << endl
|
||||
|
||||
<< endl
|
||||
|
||||
// Visual test for foreground colors
|
||||
<< fg::green << "This text has green color." << fg::reset << endl
|
||||
<< fg::red << "This text has red color." << fg::reset << endl
|
||||
<< fg::black << bg::gray << "This text has black color." << fg::reset
|
||||
<< bg::reset << endl
|
||||
<< fg::yellow << "This text has yellow color." << fg::reset << endl
|
||||
<< fg::blue << "This text has blue color." << fg::reset << endl
|
||||
<< fg::magenta << "This text has magenta color." << fg::reset << endl
|
||||
<< fg::cyan << "This text has cyan color." << fg::reset << endl
|
||||
<< fg::gray << "This text has gray color." << style::reset << endl
|
||||
|
||||
<< endl
|
||||
|
||||
// Visual test for bright background colors
|
||||
<< bgB::green << fg::black << "This text has bright green background."
|
||||
<< style::reset << endl
|
||||
<< bgB::red << "This text has bright red background." << style::reset
|
||||
<< endl
|
||||
<< bgB::black << "This text has bright black background."
|
||||
<< style::reset << endl
|
||||
<< bgB::yellow << fg::black
|
||||
<< "This text has bright yellow background." << style::reset << endl
|
||||
<< bgB::blue << "This text has bright blue background." << style::reset
|
||||
<< endl
|
||||
<< bgB::magenta << "This text has bright magenta background."
|
||||
<< style::reset << endl
|
||||
<< bgB::cyan << "This text has bright cyan background." << style::reset
|
||||
<< endl
|
||||
<< bgB::gray << fg::black << "This text has bright gray background."
|
||||
<< style::reset << style::reset << endl
|
||||
|
||||
<< endl
|
||||
|
||||
// Visual test for bright foreground colors
|
||||
<< fgB::green << "This text has bright green color." << endl
|
||||
<< fgB::red << "This text has bright red color." << endl
|
||||
<< fgB::black << "This text has bright black color." << endl
|
||||
<< fgB::yellow << "This text has bright yellow color." << endl
|
||||
<< fgB::blue << "This text has bright blue color." << endl
|
||||
<< fgB::magenta << "This text has bright magenta color." << endl
|
||||
<< fgB::cyan << "This text has bright cyan color." << endl
|
||||
<< fgB::gray << "This text has bright gray color." << style::reset
|
||||
<< endl
|
||||
|
||||
<< endl
|
||||
|
||||
// Visual test for text effects
|
||||
<< style::bold << "This text is bold." << style::reset << endl
|
||||
<< style::dim << "This text is dim." << style::reset << endl
|
||||
<< style::italic << "This text is italic." << style::reset << endl
|
||||
<< style::underline << "This text is underlined." << style::reset
|
||||
<< endl
|
||||
<< style::blink << "This text text has blink effect." << style::reset
|
||||
<< endl
|
||||
<< style::rblink << "This text text has rapid blink effect."
|
||||
<< style::reset << endl
|
||||
<< style::reversed << "This text is reversed." << style::reset << endl
|
||||
<< style::conceal << "This text is concealed." << style::reset << endl
|
||||
<< style::crossed << "This text is crossed."
|
||||
<< style::reset << endl;
|
||||
}
|
||||
+53
-32
@@ -457,10 +457,10 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
return false;
|
||||
}
|
||||
|
||||
LogClientLogin("[HandleSendLoginInfoPacket] Checking Auth id [{}]", id);
|
||||
LogClientLogin("Checking authentication id [{}]", id);
|
||||
|
||||
if ((cle = client_list.CheckAuth(id, password))) {
|
||||
LogClientLogin("[HandleSendLoginInfoPacket] Checking Auth id [{}] passed", id);
|
||||
LogClientLogin("Checking authentication id [{}] passed", id);
|
||||
if (!is_player_zoning) {
|
||||
// Track who is in and who is out of the game
|
||||
char *inout= (char *) "";
|
||||
@@ -1604,17 +1604,38 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
|
||||
in.s_addr = GetIP();
|
||||
|
||||
LogInfo("Character creation request from [{}] LS#[{}] ([{}]:[{}]) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
|
||||
LogInfo("Name: [{}]", name);
|
||||
Log(Logs::Detail, Logs::WorldServer, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s",
|
||||
cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false");
|
||||
LogInfo("STR STA AGI DEX WIS INT CHA Total");
|
||||
Log(Logs::Detail, Logs::WorldServer, "%3d %3d %3d %3d %3d %3d %3d %3d",
|
||||
cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA,
|
||||
stats_sum);
|
||||
LogInfo("Face: [{}] Eye colors: [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
|
||||
LogInfo("Hairstyle: [{}] Haircolor: [{}]", cc->hairstyle, cc->haircolor);
|
||||
LogInfo("Beard: [{}] Beardcolor: [{}]", cc->beard, cc->beardcolor);
|
||||
LogInfo(
|
||||
"Character creation request from [{}] LS [{}] [{}] [{}]",
|
||||
GetCLE()->LSName(),
|
||||
GetCLE()->LSID(),
|
||||
inet_ntoa(in),
|
||||
GetPort()
|
||||
);
|
||||
LogInfo("Name [{}]", name);
|
||||
LogInfo(
|
||||
"Race [{}] Class [{}] Gender [{}] Deity [{}] Start zone [{}] Tutorial [{}]",
|
||||
cc->race,
|
||||
cc->class_,
|
||||
cc->gender,
|
||||
cc->deity,
|
||||
cc->start_zone,
|
||||
cc->tutorial ? "true" : "false"
|
||||
);
|
||||
LogInfo("STR STA AGI DEX WIS INT CHA Total");
|
||||
LogInfo(
|
||||
" [{}] [{}] [{}] [{}] [{}] [{}] [{}] [{}]",
|
||||
cc->STR,
|
||||
cc->STA,
|
||||
cc->AGI,
|
||||
cc->DEX,
|
||||
cc->WIS,
|
||||
cc->INT,
|
||||
cc->CHA,
|
||||
stats_sum
|
||||
);
|
||||
LogInfo("Face [{}] Eye colors [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
|
||||
LogInfo("Hairstyle [{}] Haircolor [{}]", cc->hairstyle, cc->haircolor);
|
||||
LogInfo("Beard [{}] Beardcolor [{}]", cc->beard, cc->beardcolor);
|
||||
|
||||
/* Validate the char creation struct */
|
||||
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
|
||||
@@ -1685,14 +1706,14 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
|
||||
/* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */
|
||||
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
|
||||
LogInfo("Found 'SoFStartZoneID' rule setting: [{}]", RuleI(World, SoFStartZoneID));
|
||||
LogInfo("Found [SoFStartZoneID] rule setting [{}]", RuleI(World, SoFStartZoneID));
|
||||
if (RuleI(World, SoFStartZoneID) > 0) {
|
||||
pp.zone_id = RuleI(World, SoFStartZoneID);
|
||||
cc->start_zone = pp.zone_id;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogInfo("Found 'TitaniumStartZoneID' rule setting: [{}]", RuleI(World, TitaniumStartZoneID));
|
||||
LogInfo("Found [TitaniumStartZoneID] rule setting [{}]", RuleI(World, TitaniumStartZoneID));
|
||||
if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */
|
||||
|
||||
pp.zone_id = RuleI(World, TitaniumStartZoneID);
|
||||
@@ -1757,12 +1778,12 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
pp.binds[0].heading = pp.heading;
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::WorldServer, "Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
|
||||
ZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
|
||||
Log(Logs::Detail, Logs::WorldServer, "Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
|
||||
ZoneName(pp.binds[0].zone_id), pp.binds[0].zone_id, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
|
||||
Log(Logs::Detail, Logs::WorldServer, "Home location: %s (%d) %0.2f, %0.2f, %0.2f",
|
||||
ZoneName(pp.binds[4].zone_id), pp.binds[4].zone_id, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
|
||||
LogInfo("Current location [{}] [{}] [{}] [{}] [{}] [{}]",
|
||||
ZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
|
||||
LogInfo("Bind location [{}] [{}] [{}] [{}] [{}]",
|
||||
ZoneName(pp.binds[0].zone_id), pp.binds[0].zone_id, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
|
||||
LogInfo("Home location [{}] [{}] [{}] [{}] [{}]",
|
||||
ZoneName(pp.binds[4].zone_id), pp.binds[4].zone_id, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
|
||||
|
||||
/* Starting Items inventory */
|
||||
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
|
||||
@@ -1966,16 +1987,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
||||
// if out of range looking it up in the table would crash stuff
|
||||
// so we return from these
|
||||
if (classtemp >= PLAYER_CLASS_COUNT) {
|
||||
LogInfo(" class is out of range");
|
||||
LogInfo(" class is out of range");
|
||||
return false;
|
||||
}
|
||||
if (racetemp >= _TABLE_RACES) {
|
||||
LogInfo(" race is out of range");
|
||||
LogInfo(" race is out of range");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs?
|
||||
LogInfo(" invalid race/class combination");
|
||||
LogInfo(" invalid race/class combination");
|
||||
// we return from this one, since if it's an invalid combination our table
|
||||
// doesn't have meaningful values for the stats
|
||||
return false;
|
||||
@@ -2003,36 +2024,36 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
||||
// that are messed up not just the first hit
|
||||
|
||||
if (bTOTAL + stat_points != cTOTAL) {
|
||||
LogInfo(" stat points total doesn't match expected value: expecting [{}] got [{}]", bTOTAL + stat_points, cTOTAL);
|
||||
LogInfo(" stat points total doesn't match expected value: expecting [{}] got [{}]", bTOTAL + stat_points, cTOTAL);
|
||||
Charerrors++;
|
||||
}
|
||||
|
||||
if (cc->STR > bSTR + stat_points || cc->STR < bSTR) {
|
||||
LogInfo(" stat STR is out of range");
|
||||
LogInfo(" stat STR is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->STA > bSTA + stat_points || cc->STA < bSTA) {
|
||||
LogInfo(" stat STA is out of range");
|
||||
LogInfo(" stat STA is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) {
|
||||
LogInfo(" stat AGI is out of range");
|
||||
LogInfo(" stat AGI is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) {
|
||||
LogInfo(" stat DEX is out of range");
|
||||
LogInfo(" stat DEX is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) {
|
||||
LogInfo(" stat WIS is out of range");
|
||||
LogInfo(" stat WIS is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->INT > bINT + stat_points || cc->INT < bINT) {
|
||||
LogInfo(" stat INT is out of range");
|
||||
LogInfo(" stat INT is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) {
|
||||
LogInfo(" stat CHA is out of range");
|
||||
LogInfo(" stat CHA is out of range");
|
||||
Charerrors++;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ void ClientListEntry::SetOnline(ZoneServer *iZS, CLE_Status iOnline)
|
||||
void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||
{
|
||||
LogClientLogin(
|
||||
"ClientListEntry::SetOnline for [{}] ({}) = [{}] ({})",
|
||||
"Online status [{}] ({}) status [{}] ({})",
|
||||
AccountName(),
|
||||
AccountID(),
|
||||
CLEStatusString[CLE_Status::Online],
|
||||
|
||||
@@ -636,13 +636,6 @@ void ConsoleZoneBootup(
|
||||
tmpname[0] = '*';
|
||||
strcpy(&tmpname[1], connection->UserName().c_str());
|
||||
|
||||
Log(Logs::Detail,
|
||||
Logs::WorldServer,
|
||||
"Console ZoneBootup: %s, %s, %s",
|
||||
tmpname,
|
||||
args[1].c_str(),
|
||||
args[0].c_str());
|
||||
|
||||
if (args.size() > 2) {
|
||||
zoneserver_list.SOPZoneBootup(
|
||||
tmpname,
|
||||
|
||||
@@ -626,7 +626,7 @@ void LoginServer::SendInfo()
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"[LoginServer::SendInfo] protocol_version [{}] server_version [{}] long_name [{}] short_name [{}] account_name [{}] remote_ip_address [{}] local_ip [{}]",
|
||||
"protocol_version [{}] server_version [{}] long_name [{}] short_name [{}] account_name [{}] remote_ip_address [{}] local_ip [{}]",
|
||||
l->protocol_version,
|
||||
l->server_version,
|
||||
l->server_long_name,
|
||||
|
||||
+2
-2
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
|
||||
|
||||
Config = WorldConfig::get();
|
||||
|
||||
LogInfo("CURRENT_VERSION: [{}]", CURRENT_VERSION);
|
||||
LogInfo("CURRENT_VERSION [{}]", CURRENT_VERSION);
|
||||
|
||||
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||
LogError("Could not set signal handler");
|
||||
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
|
||||
zoneserver_list.Add(new ZoneServer(connection, console.get()));
|
||||
|
||||
LogInfo(
|
||||
"New Zone Server connection from [{}] at [{}:{}] zone_count ({})",
|
||||
"New Zone Server connection from [{}] at [{}:{}] zone_count [{}]",
|
||||
connection->Handle()->RemoteIP(),
|
||||
connection->Handle()->RemotePort(),
|
||||
connection->GetUUID(),
|
||||
|
||||
@@ -324,6 +324,11 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
|
||||
zone_store.LoadZones(content_db);
|
||||
|
||||
if (zone_store.GetZones().empty()) {
|
||||
LogError("Failed to load zones data, check your schema for possible errors");
|
||||
return 1;
|
||||
}
|
||||
|
||||
LogInfo("Clearing groups");
|
||||
database.ClearGroup();
|
||||
LogInfo("Clearing raids");
|
||||
@@ -338,12 +343,10 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
LogError("Error: Could not load item data. But ignoring");
|
||||
}
|
||||
|
||||
LogInfo("Loading skill caps");
|
||||
if (!content_db.LoadSkillCaps(std::string(hotfix_name))) {
|
||||
LogError("Error: Could not load skill cap data. But ignoring");
|
||||
}
|
||||
|
||||
LogInfo("Loading guilds");
|
||||
guild_mgr.LoadGuilds();
|
||||
|
||||
//rules:
|
||||
@@ -369,9 +372,6 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
|
||||
LogInfo("No rule set configured, using default rules");
|
||||
}
|
||||
else {
|
||||
LogInfo("Loaded default rule set [default]", tmp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (!RuleManager::Instance()->RestoreRuleNotes(&database)) {
|
||||
@@ -380,7 +380,6 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
}
|
||||
|
||||
EQ::InitializeDynamicLookups();
|
||||
LogInfo("Initialized dynamic dictionary entries");
|
||||
|
||||
if (RuleB(World, ClearTempMerchantlist)) {
|
||||
LogInfo("Clearing temporary merchant lists");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "world_server_cli.h"
|
||||
|
||||
/**
|
||||
* @param argc
|
||||
* @param argv
|
||||
@@ -26,6 +27,7 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
|
||||
function_map["database:schema"] = &WorldserverCLI::DatabaseGetSchema;
|
||||
function_map["database:dump"] = &WorldserverCLI::DatabaseDump;
|
||||
function_map["test:test"] = &WorldserverCLI::TestCommand;
|
||||
function_map["test:colors"] = &WorldserverCLI::TestColors;
|
||||
function_map["test:expansion"] = &WorldserverCLI::ExpansionTestCommand;
|
||||
function_map["test:repository"] = &WorldserverCLI::TestRepository;
|
||||
function_map["test:repository2"] = &WorldserverCLI::TestRepository2;
|
||||
@@ -39,6 +41,7 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
|
||||
#include "cli/database_set_account_status.cpp"
|
||||
#include "cli/database_version.cpp"
|
||||
#include "cli/test.cpp"
|
||||
#include "cli/test_colors.cpp"
|
||||
#include "cli/test_expansion.cpp"
|
||||
#include "cli/test_repository.cpp"
|
||||
#include "cli/test_repository_2.cpp"
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
static void DatabaseGetSchema(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void DatabaseDump(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void TestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void TestColors(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void ExpansionTestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void TestRepository(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void TestRepository2(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
|
||||
@@ -102,7 +102,7 @@ bool ZoneServer::SetZone(uint32 in_zone_id, uint32 in_instance_id, bool in_is_st
|
||||
|
||||
if (in_zone_id) {
|
||||
LogInfo(
|
||||
"Setting zone process to Zone: {} ({}) ID: {}{}{}",
|
||||
"Setting zone process to Zone [{}] [{}] zone_id [{}] {}{}",
|
||||
zone_long_name,
|
||||
zone_short_name,
|
||||
in_zone_id,
|
||||
|
||||
Reference in New Issue
Block a user