chore(Core/Logging): replace most server loggers (#5726)

* chore(Core/Logging): replace most server loggers

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Kargatum
2021-06-21 08:07:12 +07:00
committed by GitHub
parent 9f80a592bb
commit 5787d00d54
199 changed files with 2312 additions and 4487 deletions

View File

@@ -50,13 +50,12 @@ Vehicle::~Vehicle()
{
if (Unit* unit = ObjectAccessor::GetUnit(*_me, itr->second.Passenger.Guid))
{
LOG_INFO("server", "ZOMG! ~Vehicle(), unit: %s, entry: %u, typeid: %u, this_entry: %u, this_typeid: %u!", unit->GetName().c_str(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0);
LOG_FATAL("vehicles", "ZOMG! ~Vehicle(), unit: %s, entry: %u, typeid: %u, this_entry: %u, this_typeid: %u!", unit->GetName().c_str(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0);
unit->_ExitVehicle();
}
else
LOG_INFO("server", "ZOMG! ~Vehicle(), unknown guid!");
LOG_FATAL("vehicles", "ZOMG! ~Vehicle(), unknown guid!");
}
//ASSERT(!itr->second.IsEmpty());
}
void Vehicle::Install()
@@ -93,14 +92,12 @@ void Vehicle::Uninstall()
/// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
{
LOG_ERROR("server", "Vehicle %s attempts to uninstall, but already has STATUS_UNINSTALLING! "
LOG_ERROR("vehicles", "Vehicle %s attempts to uninstall, but already has STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString().c_str());
return;
}
_status = STATUS_UNINSTALLING;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Vehicle::Uninstall %s", _me->GetGUID().ToString().c_str());
#endif
RemoveAllPassengers();
if (GetBase()->GetTypeId() == TYPEID_UNIT)
@@ -109,9 +106,7 @@ void Vehicle::Uninstall()
void Vehicle::Reset(bool evading /*= false*/)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Vehicle::Reset: %s", _me->GetGUID().ToString().c_str());
#endif
if (_me->GetTypeId() == TYPEID_PLAYER)
{
if (_usableSeatNum)
@@ -195,9 +190,7 @@ void Vehicle::ApplyAllImmunities()
void Vehicle::RemoveAllPassengers()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Vehicle::RemoveAllPassengers. %s", _me->GetGUID().ToString().c_str());
#endif
// Passengers always cast an aura with SPELL_AURA_CONTROL_VEHICLE on the vehicle
// We just remove the aura and the unapply handler will make the target leave the vehicle.
@@ -261,14 +254,12 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
/// @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
if (_status == STATUS_UNINSTALLING)
{
LOG_ERROR("server", "Vehicle %s attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! "
LOG_ERROR("vehicles", "Vehicle %s attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString().c_str(), entry, (int32)seatId);
return;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Vehicle: Installing accessory entry %u on vehicle entry %u (seat:%i)", entry, GetCreatureEntry(), seatId);
#endif
if (Unit* passenger = GetPassenger(seatId))
{
// already installed
@@ -307,10 +298,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
/// @Prevent adding passengers when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
if (_status == STATUS_UNINSTALLING)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Passenger %s, attempting to board vehicle %s during uninstall! SeatId: %i",
unit->GetGUID().ToString().c_str(), _me->GetGUID().ToString().c_str(), (int32)seatId);
#endif
return false;
}
@@ -344,10 +333,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
ASSERT(seat->second.IsEmpty());
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Unit %s enter vehicle entry %u id %u (%s) seat %d",
unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString().c_str(), (int32)seat->first);
#endif
seat->second.Passenger.Guid = unit->GetGUID();
seat->second.Passenger.IsUnselectable = unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -394,15 +381,15 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
}
catch (...)
{
LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy()!");
LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u", _me ? 1 : 0);
LOG_INFO("vehicles", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy()!");
LOG_INFO("vehicles", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u", _me ? 1 : 0);
if (!_me)
return false;
LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld());
LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld());
LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s!", _me->GetName().c_str());
LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). typeid: %u!", _me->GetTypeId());
LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s, typeid: %u, in world: %u, duringremove: %u has wrong CharmType! Charmer %s, typeid: %u, in world: %u, duringremove: %u.", _me->GetName().c_str(), _me->GetTypeId(), _me->IsInWorld(), _me->IsDuringRemoveFromWorld(), unit->GetName().c_str(), unit->GetTypeId(), unit->IsInWorld(), unit->IsDuringRemoveFromWorld());
LOG_INFO("vehicles", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld());
LOG_INFO("vehicles", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld());
LOG_INFO("vehicles", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s!", _me->GetName().c_str());
LOG_INFO("vehicles", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). typeid: %u!", _me->GetTypeId());
LOG_INFO("vehicles", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s, typeid: %u, in world: %u, duringremove: %u has wrong CharmType! Charmer %s, typeid: %u, in world: %u, duringremove: %u.", _me->GetName().c_str(), _me->GetTypeId(), _me->IsInWorld(), _me->IsDuringRemoveFromWorld(), unit->GetName().c_str(), unit->GetTypeId(), unit->IsInWorld(), unit->IsDuringRemoveFromWorld());
return false;
}
}
@@ -456,10 +443,8 @@ void Vehicle::RemovePassenger(Unit* unit)
if (seat == Seats.end())
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Unit %s exit vehicle entry %u id %u (%s) seat %d",
unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString().c_str(), (int32)seat->first);
#endif
if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum)
_me->SetFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
@@ -525,9 +510,7 @@ void Vehicle::Dismiss()
if (GetBase()->GetTypeId() != TYPEID_UNIT)
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("vehicles", "Vehicle::Dismiss %s", _me->GetGUID().ToString().c_str());
#endif
Uninstall();
GetBase()->ToCreature()->DespawnOrUnsummon();
}