refactor(Core/Logging): switch to fmt style for LOG_ (#10366)

* feat(Core/Common): add support fmt style for ASSERT and ABORT

* correct CheckCompactArrayMaskOverflow

* 1

* Update src/server/game/Spells/Spell.cpp

* rework logging

* add fmt replace logs

* logging

* FMT_LOG_

* settings

* fix startup

* 1

* 2

* 3

* 4

* 5

* fmt::print

* to fmt
This commit is contained in:
Kargatum
2022-01-27 22:44:41 +07:00
committed by GitHub
parent 5228d29379
commit 5969df4e30
211 changed files with 3689 additions and 3842 deletions

View File

@@ -59,7 +59,7 @@ Vehicle::~Vehicle()
{
if (Unit* unit = ObjectAccessor::GetUnit(*_me, itr->second.Passenger.Guid))
{
LOG_FATAL("vehicles", "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", "Vehicle(), unit: {}, entry: {}, typeid: {}, this_entry: {}, this_typeid: {}!", unit->GetName(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0);
unit->_ExitVehicle();
}
else
@@ -101,12 +101,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("vehicles", "Vehicle %s attempts to uninstall, but already has STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString().c_str());
LOG_ERROR("vehicles", "Vehicle {} attempts to uninstall, but already has STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString());
return;
}
_status = STATUS_UNINSTALLING;
LOG_DEBUG("vehicles", "Vehicle::Uninstall %s", _me->GetGUID().ToString().c_str());
LOG_DEBUG("vehicles", "Vehicle::Uninstall {}", _me->GetGUID().ToString());
RemoveAllPassengers();
if (GetBase()->GetTypeId() == TYPEID_UNIT)
@@ -115,7 +115,7 @@ void Vehicle::Uninstall()
void Vehicle::Reset(bool evading /*= false*/)
{
LOG_DEBUG("vehicles", "Vehicle::Reset: %s", _me->GetGUID().ToString().c_str());
LOG_DEBUG("vehicles", "Vehicle::Reset: {}", _me->GetGUID().ToString());
if (_me->GetTypeId() == TYPEID_PLAYER)
{
if (_usableSeatNum)
@@ -199,7 +199,7 @@ void Vehicle::ApplyAllImmunities()
void Vehicle::RemoveAllPassengers()
{
LOG_DEBUG("vehicles", "Vehicle::RemoveAllPassengers. %s", _me->GetGUID().ToString().c_str());
LOG_DEBUG("vehicles", "Vehicle::RemoveAllPassengers. {}", _me->GetGUID().ToString());
// 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.
@@ -263,12 +263,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("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);
LOG_ERROR("vehicles", "Vehicle {} attempts to install accessory Entry: {} on seat {} with STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString(), entry, (int32)seatId);
return;
}
LOG_DEBUG("vehicles", "Vehicle: Installing accessory entry %u on vehicle entry %u (seat:%i)", entry, GetCreatureEntry(), seatId);
LOG_DEBUG("vehicles", "Vehicle: Installing accessory entry {} on vehicle entry {} (seat:{})", entry, GetCreatureEntry(), seatId);
if (Unit* passenger = GetPassenger(seatId))
{
// already installed
@@ -307,8 +307,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)
{
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);
LOG_DEBUG("vehicles", "Passenger {}, attempting to board vehicle {} during uninstall! SeatId: {}",
unit->GetGUID().ToString(), _me->GetGUID().ToString(), (int32)seatId);
return false;
}
@@ -342,8 +342,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
ASSERT(seat->second.IsEmpty());
}
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);
LOG_DEBUG("vehicles", "Unit {} enter vehicle entry {} id {} ({}) seat {}",
unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString(), (int32)seat->first);
seat->second.Passenger.Guid = unit->GetGUID();
seat->second.Passenger.IsUnselectable = unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -391,14 +391,14 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
catch (...)
{
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy()!");
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u", _me ? 1 : 0);
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). not null: {}", _me ? 1 : 0);
if (!_me)
return false;
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld());
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld());
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s!", _me->GetName().c_str());
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). typeid: %u!", _me->GetTypeId());
LOG_INFO("vehicles", "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", "CRASH! Try-catch in Unit::SetCharmedBy(). Is: {}!", _me->IsInWorld());
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). Is2: {}!", _me->IsDuringRemoveFromWorld());
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). Unit {}!", _me->GetName());
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). typeid: {}!", _me->GetTypeId());
LOG_INFO("vehicles", "CRASH! Try-catch in Unit::SetCharmedBy(). Unit {}, typeid: {}, in world: {}, duringremove: {} has wrong CharmType! Charmer {}, typeid: {}, in world: {}, duringremove: {}.", _me->GetName(), _me->GetTypeId(), _me->IsInWorld(), _me->IsDuringRemoveFromWorld(), unit->GetName(), unit->GetTypeId(), unit->IsInWorld(), unit->IsDuringRemoveFromWorld());
return false;
}
}
@@ -451,13 +451,13 @@ void Vehicle::RemovePassenger(Unit* unit)
// ASSERT(seat != Seats.end());
if (seat == Seats.end())
{
LOG_ERROR("vehicles", "Vehicle::RemovePassenger: Vehicle entry (%u) id (%u) is dissmised and removed all existing passangers, but the unit (%s) was not on the vehicle!",
_me->GetEntry(), _vehicleInfo->m_ID, unit->GetName().c_str());
LOG_ERROR("vehicles", "Vehicle::RemovePassenger: Vehicle entry ({}) id ({}) is dissmised and removed all existing passangers, but the unit ({}) was not on the vehicle!",
_me->GetEntry(), _vehicleInfo->m_ID, unit->GetName());
return;
}
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);
LOG_DEBUG("vehicles", "Unit {} exit vehicle entry {} id {} ({}) seat {}",
unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString(), (int32)seat->first);
if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum)
_me->SetFlag(UNIT_NPC_FLAGS, (_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
@@ -523,7 +523,7 @@ void Vehicle::Dismiss()
if (GetBase()->GetTypeId() != TYPEID_UNIT)
return;
LOG_DEBUG("vehicles", "Vehicle::Dismiss %s", _me->GetGUID().ToString().c_str());
LOG_DEBUG("vehicles", "Vehicle::Dismiss {}", _me->GetGUID().ToString());
Uninstall();
GetBase()->ToCreature()->DespawnOrUnsummon();
}