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
@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read attachment gdt entry: \"{}\"\n", assetName);
con::error("Failed to read attachment gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}
@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "Game/T6/Weapon/AttachmentFields.h"
#include "Game/T6/Weapon/WeaponStrings.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -113,7 +114,7 @@ namespace attachment
infoString, *attachment, m_zone.m_script_strings, m_memory, context, registration, attachment_fields, std::extent_v<decltype(attachment_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse attachment: \"{}\"\n", assetName);
con::error("Failed to parse attachment: \"{}\"", assetName);
return AssetCreationResult::Failure();
}
@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AttachmentCommon.h"
#include <cstring>
@@ -34,7 +35,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}
@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include <cstring>
#include <format>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read attachment unique gdt entry: \"{}\"\n", assetName);
con::error("Failed to read attachment unique gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}
@@ -4,6 +4,7 @@
#include "Game/T6/T6.h"
#include "Game/T6/Weapon/AttachmentUniqueFields.h"
#include "Game/T6/Weapon/WeaponStrings.h"
#include "Utils/Logging/Log.h"
#include <cassert>
#include <cstring>
@@ -48,13 +49,13 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse hide tags as array\n";
con::error("Failed to parse hide tags as array");
return false;
}
if (valueArray.size() > std::extent_v<decltype(WeaponFullDef::hideTags)>)
{
std::cerr << std::format("Cannot have more than {} hide tags!\n", std::extent_v<decltype(WeaponFullDef::hideTags)>);
con::error("Cannot have more than {} hide tags!", std::extent_v<decltype(WeaponFullDef::hideTags)>);
return false;
}
@@ -93,7 +94,7 @@ namespace
if (camo == nullptr)
{
std::cerr << std::format("Failed to load camo asset \"{}\"\n", value);
con::error("Failed to load camo asset \"{}\"", value);
return false;
}
@@ -143,7 +144,7 @@ namespace
std::vector<eAttachment> attachmentsFromName;
if (!attachment_unique::ExtractAttachmentsFromAssetNameT6(assetName, attachmentsFromName))
{
std::cerr << std::format("Failed to determine attachments from attachment unique name \"{}\"\n", assetName);
con::error("Failed to determine attachments from attachment unique name \"{}\"", assetName);
return false;
}
@@ -236,7 +237,7 @@ namespace attachment_unique
std::extent_v<decltype(attachment_unique_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse attachment unique: \"{}\"\n", assetName);
con::error("Failed to parse attachment unique: \"{}\"", assetName);
return AssetCreationResult::Failure();
}
@@ -4,6 +4,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AttachmentUniqueCommon.h"
#include <cstring>
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON_ATTACHMENT_UNIQUE, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}
@@ -3,6 +3,7 @@
#include "Game/T6/Json/JsonWeaponCamo.h"
#include "Game/T6/T6.h"
#include "Pool/GlobalAssetPool.h"
#include "Utils/Logging/Log.h"
#include "Weapon/CamoCommon.h"
#include <cstring>
@@ -40,7 +41,7 @@ namespace
if (type != "weaponCamo" || version != 1u)
{
std::cerr << std::format("Tried to load weapon camo \"{}\" but did not find expected type weaponCamo of version {}\n", weaponCamo.name, 1u);
con::error("Tried to load weapon camo \"{}\" but did not find expected type weaponCamo of version {}", weaponCamo.name, 1u);
return false;
}
@@ -49,7 +50,7 @@ namespace
}
catch (const json::exception& e)
{
std::cerr << std::format("Failed to parse json of weapon camo: {}\n", e.what());
con::error("Failed to parse json of weapon camo: {}", e.what());
}
return false;
@@ -58,7 +59,7 @@ namespace
private:
static void PrintError(const WeaponCamo& weaponCamo, const std::string& message)
{
std::cerr << std::format("Cannot load weapon camo \"{}\": {}\n", weaponCamo.name, message);
con::error("Cannot load weapon camo \"{}\": {}", weaponCamo.name, message);
}
bool CreateWeaponCamoSetFromJson(const JsonWeaponCamoSet& jWeaponCamoSet, WeaponCamoSet& weaponCamoSet, const WeaponCamo& weaponCamo) const
@@ -263,7 +264,7 @@ namespace
const JsonLoader loader(*file.m_stream, m_memory, context, registration);
if (!loader.Load(*weaponCamo))
{
std::cerr << std::format("Failed to load weapon camo \"{}\"\n", assetName);
con::error("Failed to load weapon camo \"{}\"", assetName);
return AssetCreationResult::Failure();
}
@@ -3,6 +3,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "WeaponInfoStringLoaderT6.h"
#include <cstring>
@@ -31,7 +32,7 @@ namespace
InfoString infoString;
if (!infoString.FromGdtProperties(*gdtEntry))
{
std::cerr << std::format("Failed to read weapon gdt entry: \"{}\"\n", assetName);
con::error("Failed to read weapon gdt entry: \"{}\"", assetName);
return AssetCreationResult::Failure();
}
@@ -5,6 +5,7 @@
#include "Game/T6/T6.h"
#include "Game/T6/Weapon/WeaponFields.h"
#include "Game/T6/Weapon/WeaponStrings.h"
#include "Utils/Logging/Log.h"
#include "Weapon/AccuracyGraphLoader.h"
#include <cassert>
@@ -126,13 +127,13 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse hide tags as array\n";
con::error("Failed to parse hide tags as array");
return false;
}
if (valueArray.size() > std::extent_v<decltype(WeaponFullDef::hideTags)>)
{
std::cerr << std::format("Cannot have more than {} hide tags!\n", std::extent_v<decltype(WeaponFullDef::hideTags)>);
con::error("Cannot have more than {} hide tags!", std::extent_v<decltype(WeaponFullDef::hideTags)>);
return false;
}
@@ -183,13 +184,13 @@ namespace
std::vector<std::array<std::string, 2>> pairs;
if (!ParseAsArray(value, pairs))
{
std::cerr << "Failed to parse notetracksoundmap as pairs\n";
con::error("Failed to parse notetracksoundmap as pairs");
return false;
}
if (pairs.size() > std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>)
{
std::cerr << "Cannot have more than " << std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)> << " notetracksoundmap entries!\n";
con::error("Cannot have more than {} notetracksoundmap entries!", std::extent_v<decltype(WeaponFullDef::notetrackSoundMapKeys)>);
return false;
}
@@ -239,7 +240,7 @@ namespace
if (camo == nullptr)
{
std::cerr << std::format("Failed to load camo asset \"{}\"\n", value);
con::error("Failed to load camo asset \"{}\"", value);
return false;
}
@@ -254,7 +255,7 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse attachments as array\n";
con::error("Failed to parse attachments as array");
return false;
}
@@ -265,7 +266,7 @@ namespace
auto* attachmentAssetInfo = m_context.ForceLoadDependency<AssetAttachment>(attachmentName);
if (attachmentAssetInfo == nullptr)
{
std::cerr << std::format("Failed to load attachment asset \"{}\"\n", attachmentName);
con::error("Failed to load attachment asset \"{}\"", attachmentName);
return false;
}
@@ -273,17 +274,17 @@ namespace
if (static_cast<unsigned>(attachmentAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT)
{
std::cerr << std::format(
"Invalid attachment type {} for attachment asset \"{}\"\n", static_cast<unsigned>(attachmentAsset->attachmentType), attachmentName);
con::error(
"Invalid attachment type {} for attachment asset \"{}\"", static_cast<unsigned>(attachmentAsset->attachmentType), attachmentName);
return false;
}
if (attachments[attachmentAsset->attachmentType] != nullptr)
{
std::cerr << std::format("Already loaded attachment with same type {}: \"{}\", \"{}\"\n",
static_cast<unsigned>(attachmentAsset->attachmentType),
attachments[attachmentAsset->attachmentType]->szInternalName,
attachmentName);
con::error("Already loaded attachment with same type {}: \"{}\", \"{}\"",
static_cast<unsigned>(attachmentAsset->attachmentType),
attachments[attachmentAsset->attachmentType]->szInternalName,
attachmentName);
return false;
}
@@ -305,7 +306,7 @@ namespace
std::vector<std::string> valueArray;
if (!ParseAsArray(value, valueArray))
{
std::cerr << "Failed to parse attachment uniques as array\n";
con::error("Failed to parse attachment uniques as array");
return false;
}
@@ -317,7 +318,7 @@ namespace
auto* attachmentUniqueAssetInfo = m_context.ForceLoadDependency<AssetAttachmentUnique>(attachmentUniqueName);
if (attachmentUniqueAssetInfo == nullptr)
{
std::cerr << std::format("Failed to load attachment unique asset \"{}\"\n", attachmentUniqueName);
con::error("Failed to load attachment unique asset \"{}\"", attachmentUniqueName);
return false;
}
@@ -327,9 +328,8 @@ namespace
{
if (attachmentCombinationIndex >= std::extent_v<decltype(WeaponFullDef::attachmentUniques)>)
{
std::cerr << std::format(
"Cannot have more than {} combined attachment attachment unique entries!\n",
(std::extent_v<decltype(WeaponFullDef::attachmentUniques)> - std::extent_v<decltype(WeaponFullDef::attachments)>));
con::error("Cannot have more than {} combined attachment attachment unique entries!",
(std::extent_v<decltype(WeaponFullDef::attachmentUniques)> - std::extent_v<decltype(WeaponFullDef::attachments)>));
return false;
}
@@ -340,18 +340,18 @@ namespace
{
if (static_cast<unsigned>(attachmentUniqueAsset->attachmentType) >= ATTACHMENT_TYPE_COUNT)
{
std::cerr << std::format("Invalid attachment type {} for attachment unique asset \"{}\"\n",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniqueName);
con::error("Invalid attachment type {} for attachment unique asset \"{}\"",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniqueName);
return false;
}
if (attachmentUniques[attachmentUniqueAsset->attachmentType] != nullptr)
{
std::cerr << std::format("Already loaded attachment unique with same type {}: \"{}\", \"{}\"\n",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniques[attachmentUniqueAsset->attachmentType]->szInternalName,
attachmentUniqueName);
con::error("Already loaded attachment unique with same type {}: \"{}\", \"{}\"",
static_cast<unsigned>(attachmentUniqueAsset->attachmentType),
attachmentUniques[attachmentUniqueAsset->attachmentType]->szInternalName,
attachmentUniqueName);
return false;
}
@@ -621,7 +621,7 @@ namespace weapon
infoString, *weaponFullDef, m_zone.m_script_strings, m_memory, context, registration, weapon_fields, std::extent_v<decltype(weapon_fields)>);
if (!converter.Convert())
{
std::cerr << std::format("Failed to parse weapon: \"{}\"\n", assetName);
con::error("Failed to parse weapon: \"{}\"", assetName);
return AssetCreationResult::Failure();
}
@@ -3,6 +3,7 @@
#include "Game/T6/ObjConstantsT6.h"
#include "Game/T6/T6.h"
#include "InfoString/InfoString.h"
#include "Utils/Logging/Log.h"
#include "Weapon/WeaponCommon.h"
#include "WeaponInfoStringLoaderT6.h"
@@ -33,7 +34,7 @@ namespace
InfoString infoString;
if (!infoString.FromStream(ObjConstants::INFO_STRING_PREFIX_WEAPON, *file.m_stream))
{
std::cerr << std::format("Could not parse as info string file: \"{}\"\n", fileName);
con::error("Could not parse as info string file: \"{}\"", fileName);
return AssetCreationResult::Failure();
}