2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-05-17 07:21:43 +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
@@ -3,6 +3,7 @@
#include "Csv/CsvStream.h"
#include "Game/T6/CommonT6.h"
#include "Game/T6/T6.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <format>
@@ -65,14 +66,14 @@ namespace
if (currentRow.size() < COL_COUNT_MIN)
{
std::cerr << std::format("{} Column count lower than min column count ({})\n", ErrorPrefix(assetName, currentRowIndex), COL_COUNT_MIN);
con::error("{} Column count lower than min column count ({})", ErrorPrefix(assetName, currentRowIndex), COL_COUNT_MIN);
return AssetCreationResult::Failure();
}
int index;
if (!ParseInt(index, currentRow[ROW_INDEX]) || index < 0)
{
std::cerr << std::format("{} Failed to parse index\n", ErrorPrefix(assetName, currentRowIndex));
con::error("{} Failed to parse index", ErrorPrefix(assetName, currentRowIndex));
return AssetCreationResult::Failure();
}
@@ -118,7 +119,7 @@ namespace
}
else
{
std::cerr << std::format("{} Unknown row type \"{}\"\n", ErrorPrefix(assetName, currentRowIndex), currentRow[ROW_TYPE]);
con::error("{} Unknown row type \"{}\"", ErrorPrefix(assetName, currentRowIndex), currentRow[ROW_TYPE]);
return AssetCreationResult::Failure();
}
}
@@ -222,26 +223,26 @@ namespace
{
if (row.size() < COL_COUNT_ICON)
{
std::cerr << std::format("{} Column count lower than min column count for entries ({})\n", ErrorPrefix(assetName, rowIndex), COL_COUNT_ICON);
con::error("{} Column count lower than min column count for entries ({})", ErrorPrefix(assetName, rowIndex), COL_COUNT_ICON);
return false;
}
if (!ParseInt(icon.fontIconSize, row[ROW_ICON_SIZE]))
{
std::cerr << std::format("{} Failed to parse size\n", ErrorPrefix(assetName, rowIndex));
con::error("{} Failed to parse size", ErrorPrefix(assetName, rowIndex));
return false;
}
if (!ParseFloat(icon.xScale, row[ROW_ICON_XSCALE]) || !ParseFloat(icon.yScale, row[ROW_ICON_YSCALE]))
{
std::cerr << std::format("{} Failed to parse scale\n", ErrorPrefix(assetName, rowIndex));
con::error("{} Failed to parse scale", ErrorPrefix(assetName, rowIndex));
return false;
}
auto* materialDependency = context.LoadDependency<AssetMaterial>(row[ROW_ICON_MATERIAL]);
if (materialDependency == nullptr)
{
std::cerr << std::format("{} Failed to load material \"{}\"\n", ErrorPrefix(assetName, rowIndex), row[ROW_ICON_MATERIAL]);
con::error("{} Failed to load material \"{}\"", ErrorPrefix(assetName, rowIndex), row[ROW_ICON_MATERIAL]);
return false;
}
registration.AddDependency(materialDependency);
@@ -258,19 +259,19 @@ namespace
{
if (row.size() < COL_COUNT_ALIAS)
{
std::cerr << std::format("{} Column count lower than min column count for aliases ({})\n", ErrorPrefix(assetName, rowIndex), COL_COUNT_ALIAS);
con::error("{} Column count lower than min column count for aliases ({})", ErrorPrefix(assetName, rowIndex), COL_COUNT_ALIAS);
return false;
}
if (!ParseHashStr(alias.aliasHash, row[ROW_ALIAS_NAME]))
{
std::cerr << std::format("{} Failed to parse alias \"{}\"\n", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_NAME]);
con::error("{} Failed to parse alias \"{}\"", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_NAME]);
return false;
}
if (!ParseHashStr(alias.buttonHash, row[ROW_ALIAS_BUTTON]))
{
std::cerr << std::format("{} Failed to parse button \"{}\"\n", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_BUTTON]);
con::error("{} Failed to parse button \"{}\"", ErrorPrefix(assetName, rowIndex), row[ROW_ALIAS_BUTTON]);
return false;
}
@@ -4,6 +4,7 @@
#include "Game/T6/CommonT6.h"
#include "Game/T6/FontIcon/JsonFontIconT6.h"
#include "Game/T6/T6.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <format>
@@ -45,7 +46,7 @@ namespace
if (type != "font-icon" || version != 1u)
{
std::cerr << std::format("Tried to load font icon \"{}\" but did not find expected type font-icon of version 1\n", assetName);
con::error("Tried to load font icon \"{}\" but did not find expected type font-icon of version 1", assetName);
return AssetCreationResult::Failure();
}
@@ -55,7 +56,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of font icon: {}\n", e.what());
con::error("Failed to parse json of font icon: {}", e.what());
}
return AssetCreationResult::Failure();
@@ -114,7 +115,7 @@ namespace
auto* materialDependency = context.LoadDependency<AssetMaterial>(jFontIconEntry.material);
if (materialDependency == nullptr)
{
std::cerr << std::format("Failed to load material \"{}\" for font icon entry \"{}\"\n", jFontIconEntry.material, jFontIconEntry.name);
con::error("Failed to load material \"{}\" for font icon entry \"{}\"", jFontIconEntry.material, jFontIconEntry.name);
return false;
}
registration.AddDependency(materialDependency);