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
+9 -8
View File
@@ -2,13 +2,14 @@
#include "IPakStreamManager.h"
#include "ObjContainer/IPak/IPakTypes.h"
#include "zlib.h"
#include "Utils/Logging/Log.h"
#include <filesystem>
#include <format>
#include <iostream>
#include <memory>
#include <vector>
#include <zlib.h>
namespace fs = std::filesystem;
@@ -92,7 +93,7 @@ namespace
m_stream->read(reinterpret_cast<char*>(&indexEntry), sizeof(indexEntry));
if (m_stream->gcount() != sizeof(indexEntry))
{
std::cerr << std::format("Unexpected eof when trying to load index entry {}.\n", itemIndex);
con::error("Unexpected eof when trying to load index entry {}.", itemIndex);
return false;
}
@@ -115,7 +116,7 @@ namespace
m_stream->read(reinterpret_cast<char*>(&section), sizeof(section));
if (m_stream->gcount() != sizeof(section))
{
std::cerr << "Unexpected eof when trying to load section.\n";
con::error("Unexpected eof when trying to load section.");
return false;
}
@@ -143,19 +144,19 @@ namespace
m_stream->read(reinterpret_cast<char*>(&header), sizeof(header));
if (m_stream->gcount() != sizeof(header))
{
std::cerr << "Unexpected eof when trying to load header.\n";
con::error("Unexpected eof when trying to load header.");
return false;
}
if (header.magic != ipak_consts::IPAK_MAGIC)
{
std::cerr << std::format("Invalid ipak magic '{:#x}'.\n", header.magic);
con::error("Invalid ipak magic '{:#x}'.", header.magic);
return false;
}
if (header.version != ipak_consts::IPAK_VERSION)
{
std::cerr << std::format("Unsupported ipak version '{}'.\n", header.version);
con::error("Unsupported ipak version '{}'.", header.version);
return false;
}
@@ -167,13 +168,13 @@ namespace
if (m_index_section == nullptr)
{
std::cerr << "IPak does not contain an index section.\n";
con::error("IPak does not contain an index section.");
return false;
}
if (m_data_section == nullptr)
{
std::cerr << "IPak does not contain a data section.\n";
con::error("IPak does not contain a data section.");
return false;
}
@@ -1,6 +1,7 @@
#include "IPakEntryReadStream.h"
#include "ObjContainer/IPak/IPakTypes.h"
#include "Utils/Logging/Log.h"
#include <algorithm>
#include <cassert>
@@ -128,7 +129,7 @@ bool IPakEntryReadStream::ValidateBlockHeader(const IPakDataBlockHeader* blockHe
{
if (blockHeader->countAndOffset.count > 31)
{
std::cerr << "IPak block has more than 31 commands: " << blockHeader->countAndOffset.count << " -> Invalid\n";
con::error("IPak block has more than 31 commands: {} -> Invalid", blockHeader->countAndOffset.count);
return false;
}
@@ -142,7 +143,7 @@ bool IPakEntryReadStream::ValidateBlockHeader(const IPakDataBlockHeader* blockHe
// The game uses IPAK_COMMAND_SKIP as value for compressed when it intends to skip the specified amount of data
if (blockHeader->commands[currentCommand].compressed == 0 || blockHeader->commands[currentCommand].compressed == 1)
{
std::cerr << "IPak block offset (" << blockHeader->countAndOffset.offset << ") is not the file head (" << m_file_head << ") -> Invalid\n";
con::error("IPak block offset ({}) is not the file head ({}) -> Invalid", blockHeader->countAndOffset.offset, m_file_head);
return false;
}
}
@@ -167,7 +168,7 @@ bool IPakEntryReadStream::AdjustChunkBufferWindowForBlockHeader(const IPakDataBl
{
if (requiredChunkCount > IPAK_CHUNK_COUNT_PER_READ)
{
std::cerr << "IPak block spans over more than " << IPAK_CHUNK_COUNT_PER_READ << " chunks (" << requiredChunkCount << "), which is not supported.\n";
con::error("IPak block spans over more than {} chunks ({}), which is not supported.", IPAK_CHUNK_COUNT_PER_READ, requiredChunkCount);
return false;
}
@@ -221,7 +222,7 @@ bool IPakEntryReadStream::ProcessCommand(const size_t commandSize, const int com
if (result != LZO_E_OK)
{
std::cerr << "Decompressing block with lzo failed: " << result << "!\n";
con::error("Decompressing block with lzo failed: {}!", result);
return false;
}