2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-07 05:23:02 +00:00

chore: update all logging to use centralized logging component

This commit is contained in:
Jan Laupetin
2025-09-10 19:52:42 +02:00
parent 1bf4033f41
commit 02f20f09b6
161 changed files with 824 additions and 664 deletions

View File

@@ -13,6 +13,7 @@
#include "Parsing/PostProcessing/MemberLeafsPostProcessor.h"
#include "Parsing/PostProcessing/UnionsPostProcessor.h"
#include "Parsing/PostProcessing/UsagesPostProcessor.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <chrono>
@@ -37,7 +38,7 @@ bool CommandsFileReader::OpenBaseStream()
auto stream = std::make_unique<ParserFilesystemStream>(m_filename);
if (!stream->IsOpen())
{
std::cerr << "Could not open commands file\n";
con::error("Could not open commands file");
return false;
}
@@ -74,10 +75,7 @@ void CommandsFileReader::SetupPostProcessors()
bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository)
{
if (m_args->m_verbose)
{
std::cout << std::format("Reading commands file: {}\n", m_filename);
}
con::debug("Reading commands file: {}", m_filename);
if (!OpenBaseStream())
return false;
@@ -91,8 +89,7 @@ bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository)
const auto result = parser->Parse();
const auto end = std::chrono::steady_clock::now();
if (m_args->m_verbose)
std::cout << std::format("Processing commands took {}ms\n", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
con::debug("Processing commands took {}ms", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
if (!result)
return false;

View File

@@ -10,6 +10,7 @@
#include "Parsing/PostProcessing/CreateMemberInformationPostProcessor.h"
#include "Parsing/PostProcessing/CreateStructureInformationPostProcessor.h"
#include "Parsing/PostProcessing/IPostProcessor.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <chrono>
@@ -36,7 +37,7 @@ bool HeaderFileReader::OpenBaseStream()
auto stream = std::make_unique<ParserFilesystemStream>(m_filename);
if (!stream->IsOpen())
{
std::cerr << "Could not open header file\n";
con::error("Could not open header file");
return false;
}
@@ -71,8 +72,7 @@ void HeaderFileReader::SetupPostProcessors()
bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository)
{
if (m_args->m_verbose)
std::cout << std::format("Reading header file: {}\n", m_filename);
con::debug("Reading header file: {}", m_filename);
if (!OpenBaseStream())
return false;
@@ -88,8 +88,7 @@ bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository)
result = parser->SaveToRepository(repository);
const auto end = std::chrono::steady_clock::now();
if (m_args->m_verbose)
std::cout << std::format("Processing header took {}ms\n", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
con::debug("Processing header took {}ms", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
if (!result)
return false;

View File

@@ -2,6 +2,7 @@
#include "Domain/Definition/EnumDefinition.h"
#include "Parsing/Header/Block/HeaderBlockNone.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <iostream>
@@ -97,7 +98,7 @@ bool HeaderParserState::ResolveForwardDeclarations()
if (dataDefinition == nullptr)
{
std::cerr << std::format("Forward declaration \"{}\" was not defined\n", forwardDeclaration->GetFullName());
con::error("Forward declaration \"{}\" was not defined", forwardDeclaration->GetFullName());
return false;
}

View File

@@ -2,6 +2,7 @@
#include "Domain/Definition/ArrayDeclarationModifier.h"
#include "Utils/Alignment.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstdint>
@@ -189,7 +190,7 @@ namespace
return true;
if (structDefinition->m_flags & DefinitionWithMembers::FLAG_FIELDS_CALCULATING)
{
std::cerr << "Detected circular dependency:\n";
con::error("Detected circular dependency:");
return false;
}
@@ -212,7 +213,7 @@ namespace
return true;
if (unionDefinition->m_flags & DefinitionWithMembers::FLAG_FIELDS_CALCULATING)
{
std::cerr << "Detected circular dependency:\n";
con::error("Detected circular dependency:");
return false;
}
@@ -257,35 +258,28 @@ bool CalculateSizeAndAlignPostProcessor::PostProcess(IDataRepository* repository
{
if (repository->GetArchitecture() == Architecture::UNKNOWN)
{
std::cerr << "You must set an architecture!\n";
con::error("You must set an architecture!");
return false;
}
for (auto* structDefinition : repository->GetAllStructs())
{
if (!CalculateFields(repository, structDefinition))
{
std::cout << "\n";
return false;
}
}
for (auto* unionDefinition : repository->GetAllUnions())
{
if (!CalculateFields(repository, unionDefinition))
{
std::cout << "\n";
return false;
}
}
for (auto* typedefDeclaration : repository->GetAllTypedefs())
{
if (!CalculateFields(repository, typedefDeclaration->m_type_declaration.get()))
{
std::cout << "\n";
return false;
}
}
return true;

View File

@@ -1,5 +1,7 @@
#include "UnionsPostProcessor.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <format>
#include <iostream>
@@ -24,7 +26,7 @@ namespace
if (entriesWithoutConditionCount > 1 && !info->m_usages.empty() && !info->m_is_leaf)
{
std::cerr << std::format("Union '{}' has more than one entry without a condition!\n", info->m_definition->GetFullName());
con::error("Union '{}' has more than one entry without a condition!", info->m_definition->GetFullName());
return false;
}