[Performance] Reworked how all log calls are made in the source, see changelog.txt for more details

This commit is contained in:
Akkadius
2017-04-01 03:51:46 -05:00
parent 93a6efa95f
commit 7aa1d243b0
131 changed files with 3126 additions and 3066 deletions
+31 -31
View File
@@ -350,7 +350,7 @@ Client::~Client() {
ToggleBuyerMode(false);
if(conn_state != ClientConnectFinished) {
Log.Out(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName());
Log(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName());
ReportConnectingState();
}
@@ -511,31 +511,31 @@ void Client::SendLogoutPackets() {
void Client::ReportConnectingState() {
switch(conn_state) {
case NoPacketsReceived: //havent gotten anything
Log.Out(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet.");
Log(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet.");
break;
case ReceivedZoneEntry: //got the first packet, loading up PP
Log.Out(Logs::General, Logs::None, "Client sent initial zone packet, but we never got their player info from the database.");
Log(Logs::General, Logs::None, "Client sent initial zone packet, but we never got their player info from the database.");
break;
case PlayerProfileLoaded: //our DB work is done, sending it
Log.Out(Logs::General, Logs::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished.");
Log(Logs::General, Logs::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished.");
break;
case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather
Log.Out(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone.");
Log(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone.");
break;
case NewZoneRequested: //received and sent new zone request
Log.Out(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request.");
Log(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request.");
break;
case ClientSpawnRequested: //client sent ReqClientSpawn
Log.Out(Logs::General, Logs::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished.");
Log(Logs::General, Logs::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished.");
break;
case ZoneContentsSent: //objects, doors, zone points
Log.Out(Logs::General, Logs::None, "The rest of the zone contents were successfully sent, waiting for client ready notification.");
Log(Logs::General, Logs::None, "The rest of the zone contents were successfully sent, waiting for client ready notification.");
break;
case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc
Log.Out(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect");
Log(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect");
break;
case ClientConnectFinished: //client finally moved to finished state, were done here
Log.Out(Logs::General, Logs::None, "Client is successfully connected.");
Log(Logs::General, Logs::None, "Client is successfully connected.");
break;
};
}
@@ -736,7 +736,7 @@ bool Client::SendAllPackets() {
if(eqs)
eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req);
iterator.RemoveCurrent();
Log.Out(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
Log(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
}
return true;
}
@@ -784,7 +784,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
char message[4096];
strn0cpy(message, orig_message, sizeof(message));
Log.Out(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
Log(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
if (targetname == nullptr) {
targetname = (!GetTarget()) ? "" : GetTarget()->GetName();
@@ -1611,7 +1611,7 @@ void Client::UpdateAdmin(bool iFromDB) {
if(m_pp.gm)
{
Log.Out(Logs::Moderate, Logs::Zone_Server, "%s - %s is a GM", __FUNCTION__ , GetName());
Log(Logs::Moderate, Logs::Zone_Server, "%s - %s is a GM", __FUNCTION__ , GetName());
// no need for this, having it set in pp you already start as gm
// and it's also set in your spawn packet so other people see it too
// SendAppearancePacket(AT_GM, 1, false);
@@ -2019,7 +2019,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
if (booktxt2[0] != '\0') {
#if EQDEBUG >= 6
Log.Out(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str());
Log(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str());
#endif
auto outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct));
@@ -2239,7 +2239,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
SaveCurrency();
Log.Out(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
Log(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
}
void Client::EVENT_ITEM_ScriptStopReturn(){
@@ -2279,7 +2279,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat
SaveCurrency();
#if (EQDEBUG>=5)
Log.Out(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i",
Log(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i",
GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
#endif
}
@@ -2369,13 +2369,13 @@ bool Client::CheckIncreaseSkill(EQEmu::skills::SkillType skillid, Mob *against_w
if(zone->random.Real(0, 99) < Chance)
{
SetSkill(skillid, GetRawSkill(skillid) + 1);
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
return true;
} else {
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
}
} else {
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);
}
return false;
}
@@ -2396,10 +2396,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) {
if(zone->random.Real(0,100) < Chance) { // if they make the roll
IncreaseLanguageSkill(langid); // increase the language skill by 1
Log.Out(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance);
Log(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance);
}
else
Log.Out(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance);
Log(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance);
}
}
@@ -2508,7 +2508,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skil
Save();
Log.Out(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
Log(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
"Too many specializations skills were above 50.", GetCleanName());
}
@@ -4706,14 +4706,14 @@ void Client::HandleLDoNOpen(NPC *target)
{
if(target->GetClass() != LDON_TREASURE)
{
Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.",
Log(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.",
GetName(), target->GetName(), target->GetName());
return;
}
if(DistanceSquaredNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
{
Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was out of range",
Log(Logs::General, Logs::None, "%s tried to open %s but %s was out of range",
GetName(), target->GetName(), target->GetName());
Message(13, "Treasure chest out of range.");
return;
@@ -6351,7 +6351,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
PetRecord record;
if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record))
{
Log.Out(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id);
Log(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id);
Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
return;
}
@@ -6365,7 +6365,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
const NPCType *npc_type = database.LoadNPCTypesData(pet.npc_id);
if(npc_type == nullptr) {
Log.Out(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id);
Log(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id);
Message(0,"Unable to find pet!");
return;
}
@@ -7635,7 +7635,7 @@ void Client::SendMercPersonalInfo()
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
{
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo canceled: (%i) (%i) (%i) for %s", stancecount, mercCount, mercTypeCount, GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo canceled: (%i) (%i) (%i) for %s", stancecount, mercCount, mercTypeCount, GetName());
SendMercMerchantResponsePacket(0);
return;
}
@@ -7731,13 +7731,13 @@ void Client::SendMercPersonalInfo()
return;
}
}
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Successful for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Successful for %s.", GetName());
SendMercMerchantResponsePacket(0);
}
else
{
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Failed Due to no MercData (%i) for %s", GetMercInfo().MercTemplateID, GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Failed Due to no MercData (%i) for %s", GetMercInfo().MercTemplateID, GetName());
}
}
@@ -8505,7 +8505,7 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
Log(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
#endif
}
else
@@ -8522,7 +8522,7 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
Log(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
#endif
}
}