mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 15:46:24 +00:00
feat(Core/Logging): rework logging (#4692)
* feat(Core/Logging): rework logging * correct level for sql.sql * del unused config options * Correct build * correct after merge * whitespace 20:29:37 1. 'Player.cpp'. Replace (1) 20:29:37 2. 'ObjectMgr.cpp'. Replace (3) * 1 * correct logging * correct affter merge * 1 * 2 * LOG_LEVEL_WARN * #include "AppenderDB.h" * 3 * 4 * 5 * 1. 'WorldSocket.cpp'. Replace (1) * 6 * 1
This commit is contained in:
@@ -154,13 +154,13 @@ uint32 LootStore::LoadLootTable()
|
||||
|
||||
if (maxcount > std::numeric_limits<uint8>::max())
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: MaxCount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max());
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: MaxCount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max());
|
||||
continue; // error already printed to log/console.
|
||||
}
|
||||
|
||||
if (lootmode == 0)
|
||||
{
|
||||
sLog->outError("Table '%s' Entry %d Item %d: LootMode is equal to 0, item will never drop - setting mode 1", GetName(), entry, item);
|
||||
LOG_ERROR("server", "Table '%s' Entry %d Item %d: LootMode is equal to 0, item will never drop - setting mode 1", GetName(), entry, item);
|
||||
lootmode = 1;
|
||||
}
|
||||
|
||||
@@ -266,17 +266,17 @@ void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const
|
||||
{
|
||||
// all still listed ids isn't referenced
|
||||
for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr)
|
||||
sLog->outErrorDb("Table '%s' Entry %d isn't %s and not referenced from loot, and thus useless.", GetName(), *itr, GetEntryName());
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d isn't %s and not referenced from loot, and thus useless.", GetName(), *itr, GetEntryName());
|
||||
}
|
||||
|
||||
void LootStore::ReportNonExistingId(uint32 lootId) const
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d does not exist", GetName(), lootId);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d does not exist", GetName(), lootId);
|
||||
}
|
||||
|
||||
void LootStore::ReportNonExistingId(uint32 lootId, const char* ownerType, uint32 ownerId) const
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d does not exist but it is used by %s %d", GetName(), lootId, ownerType, ownerId);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d does not exist but it is used by %s %d", GetName(), lootId, ownerType, ownerId);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -309,13 +309,13 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
|
||||
{
|
||||
if (groupid >= 1 << 7) // it stored in 7 bit field
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: GroupId (%u) must be less %u - skipped", store.GetName(), entry, itemid, groupid, 1 << 7);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: GroupId (%u) must be less %u - skipped", store.GetName(), entry, itemid, groupid, 1 << 7);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mincount == 0)
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: wrong MinCount (%d) - skipped", store.GetName(), entry, itemid, mincount);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: wrong MinCount (%d) - skipped", store.GetName(), entry, itemid, mincount);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -324,36 +324,36 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
|
||||
if (!proto)
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (chance == 0 && groupid == 0) // Zero chance is allowed for grouped entries only
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (chance != 0 && chance < 0.000001f) // loot with low chance
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: low chance (%f) - skipped",
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: low chance (%f) - skipped",
|
||||
store.GetName(), entry, itemid, chance);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (maxcount < mincount) // wrong max count
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: MaxCount (%u) less that MinCount (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincount);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: MaxCount (%u) less that MinCount (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincount);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else // if reference loot
|
||||
{
|
||||
if (needs_quest)
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: quest required will be ignored", store.GetName(), entry, itemid);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: quest required will be ignored", store.GetName(), entry, itemid);
|
||||
else if (chance == 0) // no chance for the reference
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' Entry %d Item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
|
||||
LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -494,7 +494,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
|
||||
if (!tab)
|
||||
{
|
||||
if (!noEmptyError)
|
||||
sLog->outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
|
||||
LOG_ERROR("sql.sql", "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1264,12 +1264,12 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
|
||||
float chance = RawTotalChance();
|
||||
if (chance > 101.0f) // TODO: replace with 100% when DBs will be ready
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
|
||||
LOG_ERROR("sql.sql", "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
|
||||
}
|
||||
|
||||
if (chance >= 100.0f && !EqualChanced.empty())
|
||||
{
|
||||
sLog->outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
|
||||
LOG_ERROR("sql.sql", "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1520,7 +1520,7 @@ bool LootTemplate::addConditionItem(Condition* cond)
|
||||
{
|
||||
if (!cond || !cond->isLoaded())//should never happen, checked at loading
|
||||
{
|
||||
sLog->outError("LootTemplate::addConditionItem: condition is null");
|
||||
LOG_ERROR("server", "LootTemplate::addConditionItem: condition is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1585,7 +1585,7 @@ bool LootTemplate::isReference(uint32 id) const
|
||||
|
||||
void LoadLootTemplates_Creature()
|
||||
{
|
||||
sLog->outString("Loading creature loot templates...");
|
||||
LOG_INFO("server", "Loading creature loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1612,16 +1612,16 @@ void LoadLootTemplates_Creature()
|
||||
LootTemplates_Creature.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Disenchant()
|
||||
{
|
||||
sLog->outString("Loading disenchanting loot templates...");
|
||||
LOG_INFO("server", "Loading disenchanting loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1647,15 +1647,15 @@ void LoadLootTemplates_Disenchant()
|
||||
LootTemplates_Disenchant.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
|
||||
sLog->outString();
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Fishing()
|
||||
{
|
||||
sLog->outString("Loading fishing loot templates...");
|
||||
LOG_INFO("server", "Loading fishing loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1672,16 +1672,16 @@ void LoadLootTemplates_Fishing()
|
||||
LootTemplates_Fishing.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Gameobject()
|
||||
{
|
||||
sLog->outString("Loading gameobject loot templates...");
|
||||
LOG_INFO("server", "Loading gameobject loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1708,16 +1708,16 @@ void LoadLootTemplates_Gameobject()
|
||||
LootTemplates_Gameobject.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Item()
|
||||
{
|
||||
sLog->outString("Loading item loot templates...");
|
||||
LOG_INFO("server", "Loading item loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1734,16 +1734,16 @@ void LoadLootTemplates_Item()
|
||||
LootTemplates_Item.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Milling()
|
||||
{
|
||||
sLog->outString("Loading milling loot templates...");
|
||||
LOG_INFO("server", "Loading milling loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1765,16 +1765,16 @@ void LoadLootTemplates_Milling()
|
||||
LootTemplates_Milling.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Pickpocketing()
|
||||
{
|
||||
sLog->outString("Loading pickpocketing loot templates...");
|
||||
LOG_INFO("server", "Loading pickpocketing loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1801,16 +1801,16 @@ void LoadLootTemplates_Pickpocketing()
|
||||
LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Prospecting()
|
||||
{
|
||||
sLog->outString("Loading prospecting loot templates...");
|
||||
LOG_INFO("server", "Loading prospecting loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1832,16 +1832,16 @@ void LoadLootTemplates_Prospecting()
|
||||
LootTemplates_Prospecting.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Mail()
|
||||
{
|
||||
sLog->outString("Loading mail loot templates...");
|
||||
LOG_INFO("server", "Loading mail loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1858,16 +1858,16 @@ void LoadLootTemplates_Mail()
|
||||
LootTemplates_Mail.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Skinning()
|
||||
{
|
||||
sLog->outString("Loading skinning loot templates...");
|
||||
LOG_INFO("server", "Loading skinning loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1894,16 +1894,16 @@ void LoadLootTemplates_Skinning()
|
||||
LootTemplates_Skinning.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
|
||||
|
||||
sLog->outString();
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Spell()
|
||||
{
|
||||
sLog->outString("Loading spell loot templates...");
|
||||
LOG_INFO("server", "Loading spell loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1938,15 +1938,15 @@ void LoadLootTemplates_Spell()
|
||||
LootTemplates_Spell.ReportUnusedIds(lootIdSet);
|
||||
|
||||
if (count)
|
||||
sLog->outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
else
|
||||
sLog->outErrorDb(">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
|
||||
sLog->outString();
|
||||
LOG_ERROR("sql.sql", ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Reference()
|
||||
{
|
||||
sLog->outString("Loading reference loot templates...");
|
||||
LOG_INFO("server", "Loading reference loot templates...");
|
||||
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -1969,6 +1969,6 @@ void LoadLootTemplates_Reference()
|
||||
// output error for any still listed ids (not referenced from any loot table)
|
||||
LootTemplates_Reference.ReportUnusedIds(lootIdSet);
|
||||
|
||||
sLog->outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
LOG_INFO("server", ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user