mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-24 05:32:06 +00:00
chore: update all logging to use centralized logging component
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "GltfBinInput.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "XModel/Gltf/GltfConstants.h"
|
||||
|
||||
#include <exception>
|
||||
@@ -41,7 +42,7 @@ bool BinInput::ReadGltfData(std::istream& stream)
|
||||
|
||||
if (magic != GLTF_MAGIC)
|
||||
{
|
||||
std::cerr << "Invalid magic when trying to read GLB\n";
|
||||
con::error("Invalid magic when trying to read GLB");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ bool BinInput::ReadGltfData(std::istream& stream)
|
||||
|
||||
if (version != GLTF_VERSION)
|
||||
{
|
||||
std::cerr << std::format("Unsupported version {} when trying to read GLB: Expected version {}\n", version, GLTF_VERSION);
|
||||
con::error("Unsupported version {} when trying to read GLB: Expected version {}", version, GLTF_VERSION);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ bool BinInput::ReadGltfData(std::istream& stream)
|
||||
}
|
||||
catch (const nlohmann::json::exception& e)
|
||||
{
|
||||
std::cerr << std::format("Failed trying to parse JSON of GLB: {}\n", e.what());
|
||||
con::error("Failed trying to parse JSON of GLB: {}", e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +104,7 @@ bool BinInput::ReadGltfData(std::istream& stream)
|
||||
|
||||
if (!m_json)
|
||||
{
|
||||
std::cerr << "Failed to load GLB due to missing JSON\n";
|
||||
con::error("Failed to load GLB due to missing JSON");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,7 +117,7 @@ bool BinInput::Read(std::istream& stream, void* dest, const size_t dataSize, con
|
||||
if (stream.gcount() != dataSize)
|
||||
{
|
||||
if (errorWhenFailed)
|
||||
std::cerr << std::format("Unexpected EOF while reading GLB {}\n", readTypeName);
|
||||
con::error("Unexpected EOF while reading GLB {}", readTypeName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Internal/GltfAccessor.h"
|
||||
#include "Internal/GltfBuffer.h"
|
||||
#include "Internal/GltfBufferView.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#pragma warning(push, 0)
|
||||
#include <Eigen>
|
||||
@@ -798,7 +799,7 @@ namespace
|
||||
}
|
||||
catch (const nlohmann::json::exception& e)
|
||||
{
|
||||
std::cerr << std::format("Failed to parse GLTF JSON: {}\n", e.what());
|
||||
con::error("Failed to parse GLTF JSON: {}", e.what());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -818,7 +819,7 @@ namespace
|
||||
}
|
||||
catch (const GltfLoadException& e)
|
||||
{
|
||||
std::cerr << std::format("Failed to load GLTF: {}\n", e.Str());
|
||||
con::error("Failed to load GLTF: {}", e.Str());
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "GltfTextInput.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <exception>
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
@@ -41,7 +43,7 @@ bool TextInput::ReadGltfData(std::istream& stream)
|
||||
}
|
||||
catch (nlohmann::json::exception& e)
|
||||
{
|
||||
std::cerr << std::format("Failed to parse json of GLTF: {}", e.what());
|
||||
con::error("Failed to parse json of GLTF: {}", e.what());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include JSON_HEADER
|
||||
|
||||
#include "Asset/AssetRegistration.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Utils/QuatInt16.h"
|
||||
#include "Utils/StringUtils.h"
|
||||
#include "XModel/Gltf/GltfBinInput.h"
|
||||
@@ -79,7 +80,7 @@ namespace
|
||||
AssetRegistration<AssetXModel> registration(assetName, xmodel);
|
||||
if (!LoadFromFile(*file.m_stream, *xmodel, context, registration))
|
||||
{
|
||||
std::cerr << std::format("Failed to load xmodel \"{}\"\n", assetName);
|
||||
con::error("Failed to load xmodel \"{}\"", assetName);
|
||||
return AssetCreationResult::Failure();
|
||||
}
|
||||
|
||||
@@ -100,14 +101,14 @@ namespace
|
||||
|
||||
if (type != "xmodel" || version < 1u || version > 2u)
|
||||
{
|
||||
std::cerr << std::format("Tried to load xmodel \"{}\" but did not find expected type material of version 1 or 2\n", xmodel.name);
|
||||
con::error("Tried to load xmodel \"{}\" but did not find expected type material of version 1 or 2", xmodel.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (version == 1u)
|
||||
{
|
||||
m_gltf_bad_rotation_formulas = true;
|
||||
std::cerr << std::format("DEPRECATED: XModel {} is version 1 that made use of bad GLTF bone rotations.\n", xmodel.name);
|
||||
con::warn("DEPRECATED: XModel {} is version 1 that made use of bad GLTF bone rotations.", xmodel.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -119,7 +120,7 @@ namespace
|
||||
}
|
||||
catch (const nlohmann::json::exception& e)
|
||||
{
|
||||
std::cerr << std::format("Failed to parse json of xmodel: {}\n", e.what());
|
||||
con::error("Failed to parse json of xmodel: {}", e.what());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -127,7 +128,7 @@ namespace
|
||||
|
||||
static void PrintError(const XModel& xmodel, const std::string& message)
|
||||
{
|
||||
std::cerr << std::format("Cannot load xmodel \"{}\": {}\n", xmodel.name, message);
|
||||
con::error("Cannot load xmodel \"{}\": {}", xmodel.name, message);
|
||||
}
|
||||
|
||||
std::unique_ptr<XModelCommon> LoadModelByExtension(std::istream& stream, const std::string& extension) const
|
||||
@@ -694,7 +695,7 @@ namespace
|
||||
constexpr auto maxTriCount = std::numeric_limits<decltype(XSurface::triCount)>::max();
|
||||
if (commonObject.m_faces.size() > maxTriCount)
|
||||
{
|
||||
std::cerr << std::format("Surface cannot have more than {} faces\n", maxTriCount);
|
||||
con::error("Surface cannot have more than {} faces", maxTriCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -727,7 +728,7 @@ namespace
|
||||
constexpr auto maxVertices = std::numeric_limits<decltype(XSurface::vertCount)>::max();
|
||||
if (vertexOffset + xmodelToCommonVertexIndexLookup.size() > maxVertices)
|
||||
{
|
||||
std::cerr << std::format("Lod exceeds limit of {} vertices\n", maxVertices);
|
||||
con::error("Lod exceeds limit of {} vertices", maxVertices);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -764,7 +765,7 @@ namespace
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << std::format("Models must not have vertices that are influenced by more than {} bones\n",
|
||||
con::error("Models must not have vertices that are influenced by more than {} bones",
|
||||
std::extent_v<decltype(XSurfaceVertexInfo::vertCount)> + 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Csv/CsvStream.h"
|
||||
#include "ObjLoading.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Utils/StringUtils.h"
|
||||
|
||||
#include <format>
|
||||
@@ -17,13 +18,12 @@ bool PartClassificationState::Load(const char** hitLocNames, const size_t hitLoc
|
||||
if (m_loaded)
|
||||
return true;
|
||||
|
||||
if (ObjLoading::Configuration.Verbose)
|
||||
std::cout << "Loading part classification...\n";
|
||||
con::debug("Loading part classification...");
|
||||
|
||||
const auto file = searchPath.Open(PART_CLASSIFICATION_FILE);
|
||||
if (!file.IsOpen())
|
||||
{
|
||||
std::cerr << std::format("Could not load part classification: Failed to open {}\n", PART_CLASSIFICATION_FILE);
|
||||
con::error("Could not load part classification: Failed to open {}", PART_CLASSIFICATION_FILE);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool PartClassificationState::LoadRow(const char** hitLocStart, const char** hit
|
||||
|
||||
if (row.size() != 2)
|
||||
{
|
||||
std::cerr << "Could not load part classification: Invalid row\n";
|
||||
con::error("Could not load part classification: Invalid row");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ bool PartClassificationState::LoadRow(const char** hitLocStart, const char** hit
|
||||
const auto foundHitLoc = std::find(hitLocStart, hitLocEnd, row[1]);
|
||||
if (foundHitLoc == hitLocEnd)
|
||||
{
|
||||
std::cerr << std::format("Invalid hitloc name in row {}: {}\n", rowIndex + 1, row[1]);
|
||||
con::error("Invalid hitloc name in row {}: {}", rowIndex + 1, row[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user