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:
Kargatum
2021-04-17 16:20:07 +07:00
committed by GitHub
parent b2861be1cd
commit 4af4cbd3d9
246 changed files with 7413 additions and 6807 deletions
+13 -13
View File
@@ -183,7 +183,7 @@ uint32 DBCFileCount = 0;
static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename)
{
sLog->outError("Size of '%s' set by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
LOG_ERROR("server", "Size of '%s' set by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
// ASSERT must fail after function call
return false;
@@ -425,7 +425,7 @@ void LoadDBCStores(const std::string& dataPath)
if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
{
if (spellDiff->SpellID[x] > 0) //don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
sLog->outErrorDb("spelldifficulty_dbc: spell %i at field id: %u at spellid %i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
LOG_ERROR("sql.sql", "spelldifficulty_dbc: spell %i at field id: %u at spellid %i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
newEntry.SpellID[x] = 0; // spell was <= 0 or invalid, set to 0
}
@@ -565,7 +565,7 @@ void LoadDBCStores(const std::string& dataPath)
// error checks
if (bad_dbc_files.size() >= DBCFileCount)
{
sLog->outError("Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
LOG_ERROR("server", "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
exit(1);
}
else if (!bad_dbc_files.empty())
@@ -574,7 +574,7 @@ void LoadDBCStores(const std::string& dataPath)
for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
str += *i + "\n";
sLog->outError("Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
LOG_ERROR("server", "Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
exit(1);
}
@@ -586,14 +586,14 @@ void LoadDBCStores(const std::string& dataPath)
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
sLog->outError("You have _outdated_ DBC data. Please extract correct versions from current using client.");
LOG_ERROR("server", "You have _outdated_ DBC data. Please extract correct versions from current using client.");
exit(1);
}
LoadM2Cameras(dataPath);
sLog->outString(">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
// Convert the geomoetry from a spline value, to an actual WoW XYZ
@@ -775,7 +775,7 @@ bool readCamera(M2Camera const* cam, uint32 buffSize, M2Header const* header, Ci
void LoadM2Cameras(const std::string& dataPath)
{
sFlyByCameraStore.clear();
sLog->outString(">> Loading Cinematic Camera files");
LOG_INFO("server", ">> Loading Cinematic Camera files");
uint32 oldMSTime = getMSTime();
for (uint32 i = 0; i < sCinematicCameraStore.GetNumRows(); ++i)
@@ -813,7 +813,7 @@ void LoadM2Cameras(const std::string& dataPath)
// Reject if not at least the size of the header
if (static_cast<uint32>(fileSize) < sizeof(M2Header))
{
sLog->outError("Camera file %s is damaged. File is smaller than header size", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. File is smaller than header size", filename.c_str());
m2file.close();
continue;
}
@@ -827,7 +827,7 @@ void LoadM2Cameras(const std::string& dataPath)
// Check file has correct magic (MD20)
if (strcmp(fileCheck, "MD20"))
{
sLog->outError("Camera file %s is damaged. File identifier not found", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. File identifier not found", filename.c_str());
m2file.close();
continue;
}
@@ -847,7 +847,7 @@ void LoadM2Cameras(const std::string& dataPath)
if (header->ofsCameras + sizeof(M2Camera) > static_cast<uint32>(fileSize))
{
sLog->outError("Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
continue;
}
@@ -855,11 +855,11 @@ void LoadM2Cameras(const std::string& dataPath)
M2Camera const* cam = reinterpret_cast<M2Camera const*>(buffer.data() + header->ofsCameras);
if (!readCamera(cam, fileSize, header, dbcentry))
{
sLog->outError("Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
}
}
}
sLog->outString(">> Loaded %u cinematic waypoint sets in %u ms", (uint32)sFlyByCameraStore.size(), GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", ">> Loaded %u cinematic waypoint sets in %u ms", (uint32)sFlyByCameraStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)