mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-10-19 21:15:20 +00:00
chore: update all logging to use centralized logging component
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "InfoString.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -172,13 +174,13 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
|
||||
std::string readPrefix;
|
||||
if (!infoStream.NextField(readPrefix))
|
||||
{
|
||||
std::cerr << "Invalid info string: Empty\n";
|
||||
con::error("Invalid info string: Empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (prefix != readPrefix)
|
||||
{
|
||||
std::cerr << "Invalid info string: Prefix \"" << readPrefix << "\" did not match expected prefix \"" << prefix << "\"\n";
|
||||
con::error("Invalid info string: Prefix \"{}\" did not match expected prefix \"{}\"", readPrefix, prefix);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -188,9 +190,9 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
|
||||
if (key.empty())
|
||||
{
|
||||
if (m_keys_by_insertion.empty())
|
||||
std::cerr << "Invalid info string: Got empty key at the start of the info string\n";
|
||||
con::error("Invalid info string: Got empty key at the start of the info string");
|
||||
else
|
||||
std::cerr << "Invalid info string: Got empty key after key \"" << m_keys_by_insertion[m_keys_by_insertion.size() - 1] << "\"\n";
|
||||
con::error("Invalid info string: Got empty key after key \"{}\"", m_keys_by_insertion[m_keys_by_insertion.size() - 1]);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -198,7 +200,7 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
|
||||
std::string value;
|
||||
if (!infoStream.NextField(value))
|
||||
{
|
||||
std::cerr << "Invalid info string: Unexpected eof, no value for key \"" << key << "\"\n";
|
||||
con::error("Invalid info string: Unexpected eof, no value for key \"{}\"", key);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#include "GdtStream.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
@@ -14,7 +16,7 @@ public:
|
||||
|
||||
void GdtReader::PrintError(const std::string& message) const
|
||||
{
|
||||
std::cout << "GDT Error at line " << m_line << ": " << message << "\n";
|
||||
con::error("GDT Error at line {}: {}", m_line, message);
|
||||
}
|
||||
|
||||
int GdtReader::PeekChar()
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#include "OutputPathFilesystem.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <format>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
@@ -24,14 +26,14 @@ std::unique_ptr<std::ostream> OutputPathFilesystem::Open(const std::string& file
|
||||
fs::create_directories(containingDirectory, ec);
|
||||
if (ec)
|
||||
{
|
||||
std::cerr << std::format("Failed to create folder '{}' when try to open file '{}'\n", containingDirectory.string(), fileName);
|
||||
con::error("Failed to create folder '{}' when try to open file '{}'", containingDirectory.string(), fileName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::ofstream stream(fullNewPath, std::ios::binary | std::ios::out);
|
||||
if (!stream.is_open())
|
||||
{
|
||||
std::cerr << std::format("Failed to open file '{}'\n", fileName);
|
||||
con::error("Failed to open file '{}'", fileName);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
#include "SearchPathFilesystem.h"
|
||||
|
||||
#include "Utils/Logging/Log.h"
|
||||
#include "Utils/ObjFileStream.h"
|
||||
|
||||
#include <filesystem>
|
||||
@@ -59,6 +60,6 @@ void SearchPathFilesystem::Find(const SearchPathSearchOptions& options, const st
|
||||
}
|
||||
catch (std::filesystem::filesystem_error& e)
|
||||
{
|
||||
std::cerr << std::format("Directory Iterator threw error when trying to find files: \"{}\"\n", e.what());
|
||||
con::error("Directory Iterator threw error when trying to find files: \"{}\"", e.what());
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "Utils/Endianness.h"
|
||||
#include "Utils/FileUtils.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
@@ -232,7 +233,7 @@ namespace flac
|
||||
}
|
||||
catch (const FlacReadingException& e)
|
||||
{
|
||||
std::cerr << e.what() << "\n";
|
||||
con::error(e.what());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user