2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-24 21:52:06 +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

@@ -16,6 +16,7 @@
#include "Techset/TechniqueStateMapCache.h"
#include "Techset/TechsetCommon.h"
#include "Techset/TechsetDefinitionCache.h"
#include "Utils/Logging/Log.h"
#include <cmath>
#include <cstring>
@@ -248,7 +249,7 @@ namespace
else
throw GdtReadingException("ColorMap may not be blank in particle cloud materials");
std::cout << std::format("Using particlecloud for \"{}\"\n", m_material.info.name);
con::info("Using particlecloud for \"{}\"", m_material.info.name);
}
void mtl_tools_template()
@@ -1362,7 +1363,7 @@ namespace
}
catch (const GdtReadingException& e)
{
std::cerr << std::format("Error while trying to load material from gdt: {} @ GdtEntry \"{}\"\n", e.what(), entry->m_name);
con::error("Error while trying to load material from gdt: {} @ GdtEntry \"{}\"", e.what(), entry->m_name);
}
return AssetCreationResult::Failure();

View File

@@ -13,6 +13,7 @@
#include "Techset/TechsetDefinitionCache.h"
#include "Techset/TechsetFileReader.h"
#include "Utils/Alignment.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -103,7 +104,7 @@ namespace
if (shaderSize % sizeof(uint32_t) != 0)
{
std::cerr << std::format("Invalid shader \"{}\": Size must be dividable by {}\n", fileName, sizeof(uint32_t));
con::error("Invalid shader \"{}\": Size must be dividable by {}", fileName, sizeof(uint32_t));
return nullptr;
}

View File

@@ -2,6 +2,7 @@
#include "Game/IW4/IW4.h"
#include "Game/IW4/TechsetConstantsIW4.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,28 +32,28 @@ namespace
{
if (decl->streamCount >= std::extent_v<decltype(MaterialVertexStreamRouting::data)>)
{
std::cerr << std::format("Failed to add vertex decl stream. Too many abbreviations: {}\n", assetName);
con::error("Failed to add vertex decl stream. Too many abbreviations: {}", assetName);
return AssetCreationResult::Failure();
}
std::string destinationAbbreviation;
if (!NextAbbreviation(assetName, destinationAbbreviation, currentOffset))
{
std::cerr << std::format("Failed to detect vertex decl destination abbreviation: {}\n", assetName);
con::error("Failed to detect vertex decl destination abbreviation: {}", assetName);
return AssetCreationResult::Failure();
}
const auto foundSourceAbbreviation = std::ranges::find(materialStreamSourceAbbreviation, sourceAbbreviation);
if (foundSourceAbbreviation == std::end(materialStreamSourceAbbreviation))
{
std::cerr << std::format("Unknown vertex decl source abbreviation: {}\n", sourceAbbreviation);
con::error("Unknown vertex decl source abbreviation: {}", sourceAbbreviation);
return AssetCreationResult::Failure();
}
const auto foundDestinationAbbreviation = std::ranges::find(materialStreamDestinationAbbreviation, destinationAbbreviation);
if (foundDestinationAbbreviation == std::end(materialStreamDestinationAbbreviation))
{
std::cerr << std::format("Unknown vertex decl destination abbreviation: {}\n", destinationAbbreviation);
con::error("Unknown vertex decl destination abbreviation: {}", destinationAbbreviation);
return AssetCreationResult::Failure();
}

View File

@@ -4,6 +4,7 @@
#include "GitVersion.h"
#include "ObjContainer/IPak/IPakTypes.h"
#include "Utils/Alignment.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -143,7 +144,7 @@ namespace
const auto openFile = m_search_path.Open(fileName);
if (!openFile.IsOpen())
{
std::cerr << std::format("Failed to open file for ipak: {}\n", fileName);
con::error("Failed to open file for ipak: {}", fileName);
return nullptr;
}
@@ -388,14 +389,14 @@ namespace image
const auto file = outPath.Open(std::format("{}.ipak", m_name));
if (!file)
{
std::cerr << std::format("Failed to open file for ipak {}\n", m_name);
con::error("Failed to open file for ipak {}", m_name);
return;
}
IPakWriter writer(*file, searchPath, m_image_names);
writer.Write();
std::cout << std::format("Created ipak {} with {} entries\n", m_name, m_image_names.size());
con::info("Created ipak {} with {} entries", m_name, m_image_names.size());
}
const std::vector<std::string>& IPakToCreate::GetImageNames() const

View File

@@ -1,6 +1,7 @@
#include "IwdCreator.h"
#include "Utils/FileToZlibWrapper.h"
#include "Utils/Logging/Log.h"
#include <chrono>
#include <format>
@@ -24,7 +25,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
const auto file = outPath.Open(fileName);
if (!file)
{
std::cerr << std::format("Failed to open file for iwd {}\n", m_name);
con::error("Failed to open file for iwd {}", m_name);
return;
}
@@ -33,7 +34,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
const auto zipFile = zipOpen2(fileName.c_str(), APPEND_STATUS_CREATE, nullptr, &functions);
if (!zipFile)
{
std::cerr << std::format("Failed to open file as zip for iwd {}\n", m_name);
con::error("Failed to open file as zip for iwd {}", m_name);
return;
}
@@ -42,7 +43,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
auto readFile = searchPath.Open(filePath);
if (!readFile.IsOpen())
{
std::cerr << std::format("Failed to open file for iwd: {}\n", filePath);
con::error("Failed to open file for iwd: {}", filePath);
continue;
}
@@ -76,7 +77,7 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
zipClose(zipFile, nullptr);
std::cout << std::format("Created iwd {} with {} entries\n", m_name, m_file_paths.size());
con::info("Created iwd {} with {} entries", m_name, m_file_paths.size());
}
const std::vector<std::string>& IwdToCreate::GetFilePaths() const
@@ -100,7 +101,7 @@ IwdToCreate* IwdCreator::GetOrAddIwd(const std::string& iwdName)
void IwdCreator::Finalize(ISearchPath& searchPath, IOutputPath& outPath)
{
std::cout << std::format("Writing {} iwd files to disk\n", m_iwds.size());
con::info("Writing {} iwd files to disk", m_iwds.size());
for (const auto& iwdToCreate : m_iwds)
iwdToCreate->Build(searchPath, outPath);

View File

@@ -1,5 +1,7 @@
#include "KeyValuePairsCreator.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <format>
#include <iostream>
@@ -41,7 +43,7 @@ namespace key_value_pairs
if (endPtr != &strValue[strValue.size()])
{
std::cerr << std::format("Could not parse metadata key \"{}\" as hash\n", metaData.first);
con::error("Could not parse metadata key \"{}\" as hash", metaData.first);
continue;
}