2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-11 11:11:50 +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

@@ -6,6 +6,7 @@
#include "Image/IwiLoader.h"
#include "Image/IwiWriter8.h"
#include "ObjWriting.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -40,7 +41,7 @@ namespace
const auto filePathImage = searchPath.Open(imageFileName);
if (!filePathImage.IsOpen())
{
std::cerr << std::format("Could not find data for image \"{}\"\n", image.name);
con::error("Could not find data for image \"{}\"", image.name);
return nullptr;
}

View File

@@ -2,6 +2,7 @@
#include "Dumping/Localize/StringFileDumper.h"
#include "Localize/LocalizeCommon.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <sstream>
@@ -38,7 +39,7 @@ namespace localize
}
else
{
std::cerr << std::format("Could not create string file for dumping localized strings of zone '{}'\n", context.m_zone.m_name);
con::error("Could not create string file for dumping localized strings of zone '{}'", context.m_zone.m_name);
}
}
} // namespace localize

View File

@@ -4,6 +4,7 @@
#include "Game/IW4/ObjConstantsIW4.h"
#include "Game/IW4/TechsetConstantsIW4.h"
#include "Utils/ClassUtils.h"
#include "Utils/Logging/Log.h"
#pragma warning(push, 0)
#include <Eigen>
@@ -550,7 +551,7 @@ namespace
}
else
{
std::cout << "Could not determine material type for material \"" << m_material.info.name << "\"\n";
con::error("Could not determine material type for material \"{}\"", m_material.info.name);
}
}
@@ -937,7 +938,7 @@ namespace
else
{
std::string constantNamePart(constant.name, strnlen(constant.name, std::extent_v<decltype(constant.name)>));
std::cout << "Unknown constant: " << constantNamePart << "\n";
con::error("Unknown constant: {}", constantNamePart);
}
}
}
@@ -1031,8 +1032,7 @@ namespace
if (knownMaterialSourceName == knownTextureMaps.end())
{
assert(false);
std::cout << "Unknown material texture source name hash: 0x" << std::hex << entry.nameHash << " (" << entry.nameStart << "..."
<< entry.nameEnd << ")\n";
con::error("Unknown material texture source name hash: 0x{:x} ({}...{})", entry.nameHash, entry.nameStart, entry.nameEnd);
continue;
}
@@ -1089,7 +1089,7 @@ namespace
assert(filter != GdtFilter_e::UNKNOWN);
if (filter == GdtFilter_e::UNKNOWN)
{
std::cout << std::format("Unknown filter/mipmap combination: {} {}\n", entry.samplerState.filter, entry.samplerState.mipMap);
con::warn("Unknown filter/mipmap combination: {} {}", entry.samplerState.filter, entry.samplerState.mipMap);
continue;
}

View File

@@ -1,5 +1,7 @@
#include "RawFileDumperIW4.h"
#include "Utils/Logging/Log.h"
#include <format>
#include <stdexcept>
#include <zlib.h>
@@ -52,7 +54,7 @@ namespace raw_file
if (ret < 0)
{
std::cerr << std::format("Inflate failed when attempting to dump rawfile '{}'\n", rawFile->name);
con::error("Inflate failed when attempting to dump rawfile '{}'", rawFile->name);
inflateEnd(&zs);
return;
}

View File

@@ -2,6 +2,7 @@
#include "Sound/WavTypes.h"
#include "Sound/WavWriter.h"
#include "Utils/Logging/Log.h"
#include <format>
@@ -45,7 +46,7 @@ namespace sound
break;
default:
std::cerr << std::format("Unknown format {} for loaded sound: {}\n", loadedSound->sound.info.format, loadedSound->name);
con::error("Unknown format {} for loaded sound: {}", loadedSound->sound.info.format, loadedSound->name);
break;
}
}

View File

@@ -5,9 +5,11 @@
#include "Pool/GlobalAssetPool.h"
#include "Shader/D3D9ShaderAnalyser.h"
#include "Techset/TechsetCommon.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
#include <format>
#include <set>
#include <sstream>
#include <type_traits>
@@ -266,8 +268,8 @@ namespace IW4
{
// Cannot dump when shader is referenced due to unknown constant names and unknown version
Indent();
std::cerr << "Cannot dump vertex shader " << &vertexShader->name[1] << " due to being a referenced asset\n";
m_stream << "// Cannot dump vertex shader " << &vertexShader->name[1] << " due to being a referenced asset\n";
con::error("Cannot dump vertex shader {} due to being a referenced asset", &vertexShader->name[1]);
m_stream << std::format("// Cannot dump vertex shader {} due to being a referenced asset\n", &vertexShader->name[1]);
return;
}
vertexShader = loadedVertexShaderFromOtherZone->Asset();
@@ -321,8 +323,8 @@ namespace IW4
{
// Cannot dump when shader is referenced due to unknown constant names and unknown version
Indent();
std::cerr << "Cannot dump pixel shader " << &pixelShader->name[1] << " due to being a referenced asset\n";
m_stream << "// Cannot dump pixel shader " << &pixelShader->name[1] << " due to being a referenced asset\n";
con::error("Cannot dump pixel shader {} due to being a referenced asset", &pixelShader->name[1]);
m_stream << std::format("// Cannot dump pixel shader {} due to being a referenced asset\n", &pixelShader->name[1]);
return;
}
pixelShader = loadedPixelShaderFromOtherZone->Asset();
@@ -393,8 +395,8 @@ namespace IW4
{
// Cannot dump when shader is referenced due to unknown constant names and unknown version
Indent();
std::cerr << "Cannot dump vertex decl " << &vertexDecl->name[1] << " due to being a referenced asset\n";
m_stream << "// Cannot dump vertex decl " << &vertexDecl->name[1] << " due to being a referenced asset\n";
con::error("Cannot dump vertex decl {} due to being a referenced asset", &vertexDecl->name[1]);
m_stream << std::format("// Cannot dump vertex decl {} due to being a referenced asset\n", &vertexDecl->name[1]);
return;
}
vertexDecl = loadedVertexDeclFromOtherZone->Asset();