mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-23 16:56:39 +00:00
chore: update all logging to use centralized logging component
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Csv/CsvStream.h"
|
||||
#include "Game/IGame.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Zone/AssetNameResolver.h"
|
||||
|
||||
#include <format>
|
||||
@@ -35,7 +36,7 @@ namespace
|
||||
const auto maybeType = m_asset_name_resolver->GetAssetTypeByName(typeName);
|
||||
if (!maybeType)
|
||||
{
|
||||
std::cerr << std::format("Unknown asset type name \"{}\"\n", typeName);
|
||||
con::error("Unknown asset type name \"{}\"", typeName);
|
||||
if (failure)
|
||||
*failure = true;
|
||||
return false;
|
||||
@@ -90,7 +91,7 @@ std::optional<AssetList> AssetListReader::ReadAssetList(const std::string& zoneN
|
||||
return assetList;
|
||||
}
|
||||
else if (logMissing)
|
||||
std::cerr << std::format("Failed to open file for assetlist: {}\n", assetListFileName);
|
||||
con::error("Failed to open file for assetlist: {}", assetListFileName);
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "SequenceZoneDefinitionMetaData.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Utils/StringUtils.h"
|
||||
#include "Zone/Definition/Parsing/Matcher/ZoneDefinitionMatcherFactory.h"
|
||||
|
||||
@@ -112,11 +113,11 @@ namespace
|
||||
}
|
||||
|
||||
const auto keyPos = keyToken.GetPos();
|
||||
std::cerr << std::format("Warning: {} L{}: Zone definition \">type,{}\" is deprecated and should be removed. {}\n",
|
||||
keyPos.m_filename.get(),
|
||||
keyPos.m_line,
|
||||
keyToken.FieldValue(),
|
||||
deprecationSuggestedAction);
|
||||
con::error("Warning: {} L{}: Zone definition \">type,{}\" is deprecated and should be removed. {}",
|
||||
keyPos.m_filename.get(),
|
||||
keyPos.m_line,
|
||||
keyToken.FieldValue(),
|
||||
deprecationSuggestedAction);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include "Parsing/Impl/DefinesStreamProxy.h"
|
||||
#include "Parsing/Impl/IncludingStreamProxy.h"
|
||||
#include "Parsing/Impl/ParserSingleInputStream.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Zone/Definition/Parsing/ZoneDefinitionLexer.h"
|
||||
#include "Zone/Definition/Parsing/ZoneDefinitionParser.h"
|
||||
|
||||
@@ -44,7 +45,7 @@ void ZoneDefinitionInputStream::SetPreviouslySetGame(GameId game)
|
||||
|
||||
std::unique_ptr<ZoneDefinition> ZoneDefinitionInputStream::ReadDefinition()
|
||||
{
|
||||
std::cout << std::format("Reading zone definition file: {}\n", m_file_name);
|
||||
con::info("Reading zone definition file: {}", m_file_name);
|
||||
|
||||
const auto lexer = std::make_unique<ZoneDefinitionLexer>(m_stream);
|
||||
const auto parser = std::make_unique<ZoneDefinitionParser>(lexer.get(), m_target_name, m_search_path, *m_stream, m_previously_set_game);
|
||||
@@ -55,7 +56,7 @@ std::unique_ptr<ZoneDefinition> ZoneDefinitionInputStream::ReadDefinition()
|
||||
definition = parser->GetParsedValue();
|
||||
const auto end = std::chrono::steady_clock::now();
|
||||
|
||||
std::cout << std::format("Processing zone definition took {}ms\n", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
|
||||
con::info("Processing zone definition took {}ms", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
|
||||
|
||||
return std::move(definition);
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "XChunkProcessorInflate.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "XChunkException.h"
|
||||
|
||||
#include <format>
|
||||
@@ -26,7 +27,7 @@ size_t XChunkProcessorInflate::Process(unsigned streamNumber, const uint8_t* inp
|
||||
ret = inflate(&stream, Z_FULL_FLUSH);
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
std::cerr << std::format("inflate of stream failed with error code {}: {}\n", streamNumber, ret, stream.msg);
|
||||
con::error("inflate of stream failed with error code {}: {}", streamNumber, ret, stream.msg);
|
||||
throw XChunkException(std::format("Zone has invalid or unsupported compression: {}", stream.msg));
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#include "XChunkProcessorLzxDecompress.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
@@ -22,7 +24,7 @@ namespace
|
||||
|
||||
void LogErrorHeaderSpace(size_t remainingInputSize)
|
||||
{
|
||||
std::cerr << std::format("XMemCompress: Not enough data for header: {}\n", remainingInputSize);
|
||||
con::error("XMemCompress: Not enough data for header: {}", remainingInputSize);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -99,19 +101,19 @@ size_t XChunkProcessorLzxDecompress::Process(
|
||||
if (srcSize == 0 || dstSize == 0)
|
||||
{
|
||||
// Other implementations do not handle this as a failure, game code suggests otherwise though
|
||||
std::cerr << std::format("XMemCompress: EOF: {} {}, {}\n", srcSize, dstSize, curInputSize);
|
||||
con::error("XMemCompress: EOF: {} {}, {}", srcSize, dstSize, curInputSize);
|
||||
return curOutputOffset;
|
||||
}
|
||||
|
||||
if (static_cast<size_t>(srcSize) + suffixSize > curInputSize)
|
||||
{
|
||||
std::cerr << std::format("XMemCompress: block size bigger than remaining data: {} > {}\n", srcSize, curInputSize);
|
||||
con::error("XMemCompress: block size bigger than remaining data: {} > {}", srcSize, curInputSize);
|
||||
return curOutputOffset;
|
||||
}
|
||||
|
||||
if (dstSize > curOutputSize)
|
||||
{
|
||||
std::cerr << std::format("XMemCompress: output size bigger than remaining data: {} > {}\n", dstSize, curOutputSize);
|
||||
con::error("XMemCompress: output size bigger than remaining data: {} > {}", dstSize, curOutputSize);
|
||||
return curOutputOffset;
|
||||
}
|
||||
|
||||
@@ -123,7 +125,7 @@ size_t XChunkProcessorLzxDecompress::Process(
|
||||
|
||||
if (ret != DECR_OK)
|
||||
{
|
||||
std::cerr << std::format("XMemCompress: lzx decompression failed: {}\n", ret);
|
||||
con::error("XMemCompress: lzx decompression failed: {}", ret);
|
||||
return curOutputOffset;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user