mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
feat: Abstract Logger and simplify code (#1207)
* Logger: Rename logger to Logger from dLogger * Logger: Add compile time filename Fix include issues Add writers Add macros Add macro to force compilation * Logger: Replace calls with macros Allows for filename and line number to be logged * Logger: Add comments and remove extra define Logger: Replace with unique_ptr also flush console at exit. regular file writer should be flushed on file close. Logger: Remove constexpr on variable * Logger: Simplify code * Update Logger.cpp
This commit is contained in:
@@ -155,7 +155,7 @@ void TriggerComponent::HandleTriggerCommand(LUTriggers::Command* command, Entity
|
||||
case eTriggerCommandType::DEACTIVATE_MIXER_PROGRAM: break;
|
||||
// DEPRECATED BLOCK END
|
||||
default:
|
||||
Game::logger->LogDebug("TriggerComponent", "Event %i was not handled!", command->id);
|
||||
LOG_DEBUG("Event %i was not handled!", command->id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void TriggerComponent::HandleDestroyObject(Entity* targetEntity, std::string arg
|
||||
void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string args){
|
||||
auto* triggerComponent = targetEntity->GetComponent<TriggerComponent>();
|
||||
if (!triggerComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleToggleTrigger", "Trigger component not found!");
|
||||
LOG_DEBUG("Trigger component not found!");
|
||||
return;
|
||||
}
|
||||
triggerComponent->SetTriggerEnabled(args == "1");
|
||||
@@ -207,7 +207,7 @@ void TriggerComponent::HandleToggleTrigger(Entity* targetEntity, std::string arg
|
||||
void TriggerComponent::HandleResetRebuild(Entity* targetEntity, std::string args){
|
||||
auto* rebuildComponent = targetEntity->GetComponent<RebuildComponent>();
|
||||
if (!rebuildComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleResetRebuild", "Rebuild component not found!");
|
||||
LOG_DEBUG("Rebuild component not found!");
|
||||
return;
|
||||
}
|
||||
rebuildComponent->ResetRebuild(args == "1");
|
||||
@@ -239,7 +239,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
|
||||
|
||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandlePushObject", "Phantom Physics component not found!");
|
||||
LOG_DEBUG("Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
@@ -256,7 +256,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
|
||||
void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args){
|
||||
auto* phantomPhysicsComponent = m_Parent->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleRepelObject", "Phantom Physics component not found!");
|
||||
LOG_DEBUG("Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
float forceMultiplier;
|
||||
@@ -279,7 +279,7 @@ void TriggerComponent::HandleRepelObject(Entity* targetEntity, std::string args)
|
||||
|
||||
void TriggerComponent::HandleSetTimer(Entity* targetEntity, std::vector<std::string> argArray){
|
||||
if (argArray.size() != 2) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetTimer", "Not ehought variables!");
|
||||
LOG_DEBUG("Not ehought variables!");
|
||||
return;
|
||||
}
|
||||
float time = 0.0;
|
||||
@@ -320,7 +320,7 @@ void TriggerComponent::HandlePlayCinematic(Entity* targetEntity, std::vector<std
|
||||
void TriggerComponent::HandleToggleBBB(Entity* targetEntity, std::string args) {
|
||||
auto* character = targetEntity->GetCharacter();
|
||||
if (!character) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleToggleBBB", "Character was not found!");
|
||||
LOG_DEBUG("Character was not found!");
|
||||
return;
|
||||
}
|
||||
bool buildMode = !(character->GetBuildMode());
|
||||
@@ -336,7 +336,7 @@ void TriggerComponent::HandleUpdateMission(Entity* targetEntity, std::vector<std
|
||||
if (argArray.at(0) != "exploretask") return;
|
||||
MissionComponent* missionComponent = targetEntity->GetComponent<MissionComponent>();
|
||||
if (!missionComponent){
|
||||
Game::logger->LogDebug("TriggerComponent::HandleUpdateMission", "Mission component not found!");
|
||||
LOG_DEBUG("Mission component not found!");
|
||||
return;
|
||||
}
|
||||
missionComponent->Progress(eMissionTaskType::EXPLORE, 0, 0, argArray.at(4));
|
||||
@@ -355,7 +355,7 @@ void TriggerComponent::HandlePlayEffect(Entity* targetEntity, std::vector<std::s
|
||||
void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||
auto* skillComponent = targetEntity->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleCastSkill", "Skill component not found!");
|
||||
LOG_DEBUG("Skill component not found!");
|
||||
return;
|
||||
}
|
||||
uint32_t skillId;
|
||||
@@ -366,7 +366,7 @@ void TriggerComponent::HandleCastSkill(Entity* targetEntity, std::string args){
|
||||
void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::vector<std::string> argArray) {
|
||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
LOG_DEBUG("Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(true);
|
||||
@@ -401,7 +401,7 @@ void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::v
|
||||
void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::string args) {
|
||||
auto* phantomPhysicsComponent = targetEntity->GetComponent<PhantomPhysicsComponent>();
|
||||
if (!phantomPhysicsComponent) {
|
||||
Game::logger->LogDebug("TriggerComponent::HandleSetPhysicsVolumeEffect", "Phantom Physics component not found!");
|
||||
LOG_DEBUG("Phantom Physics component not found!");
|
||||
return;
|
||||
}
|
||||
phantomPhysicsComponent->SetPhysicsEffectActive(args == "On");
|
||||
@@ -438,6 +438,6 @@ void TriggerComponent::HandleActivatePhysics(Entity* targetEntity, std::string a
|
||||
} else if (args == "false"){
|
||||
// TODO remove Phsyics entity if there is one
|
||||
} else {
|
||||
Game::logger->LogDebug("TriggerComponent", "Invalid argument for ActivatePhysics Trigger: %s", args.c_str());
|
||||
LOG_DEBUG("Invalid argument for ActivatePhysics Trigger: %s", args.c_str());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user