mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-01-11 11:11:50 +00:00
chore: update all logging to use centralized logging component
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "RawTemplaterArguments.h"
|
||||
#include "Templating/Templater.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
@@ -21,7 +22,7 @@ class RawTemplater::Impl
|
||||
std::ifstream file(filename, std::ios::in | std::ios::binary);
|
||||
if (!file.is_open())
|
||||
{
|
||||
std::cerr << "Failed to open file \"" << filename << "\"\n";
|
||||
con::error("Failed to open file \"{}\"", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -61,7 +62,7 @@ public:
|
||||
m_build_log_file = std::ofstream(m_args.m_build_log_file, std::ios::out | std::ios::binary);
|
||||
if (!m_build_log_file.is_open())
|
||||
{
|
||||
std::cerr << "Failed to open build log file \"" << m_args.m_build_log_file << "\"\n";
|
||||
con::error("Failed to open build log file \"{}\"", m_args.m_build_log_file);
|
||||
return false;
|
||||
}
|
||||
m_write_build_log = true;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "GitVersion.h"
|
||||
#include "Utils/Arguments/CommandLineOption.h"
|
||||
#include "Utils/Arguments/UsageInformation.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
@@ -83,7 +84,7 @@ void RawTemplaterArguments::PrintUsage() const
|
||||
|
||||
void RawTemplaterArguments::PrintVersion()
|
||||
{
|
||||
std::cout << std::format("OpenAssetTools RawTemplater {}\n", GIT_VERSION);
|
||||
con::info("OpenAssetTools RawTemplater {}", GIT_VERSION);
|
||||
}
|
||||
|
||||
bool RawTemplaterArguments::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "SetDefineStreamProxy.h"
|
||||
#include "TemplatingStreamProxy.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "Utils/Logging/Log.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
@@ -219,7 +220,7 @@ namespace templating
|
||||
{
|
||||
if (!m_active_variations.empty())
|
||||
{
|
||||
std::cerr << "Template with variations must specify a filename\n";
|
||||
con::error("Template with variations must specify a filename");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -231,7 +232,7 @@ namespace templating
|
||||
m_output_stream << cachedData;
|
||||
}
|
||||
|
||||
std::cout << "Templated file \"" << m_output_file << "\"\n";
|
||||
con::info("Templated file \"{}\"", m_output_file);
|
||||
|
||||
if (buildLogFile)
|
||||
*buildLogFile << "Templated file \"" << m_output_file << "\"\n";
|
||||
@@ -276,7 +277,7 @@ namespace templating
|
||||
const auto isValidRedefinition = existingVariation->second->GetVariationType() == TemplatingVariationType::SWITCH;
|
||||
|
||||
if (!isValidRedefinition)
|
||||
std::cerr << "Redefinition of \"" << switchName << "\" as switch is invalid\n";
|
||||
con::error("Redefinition of \"{}\" as switch is invalid", switchName);
|
||||
|
||||
return isValidRedefinition;
|
||||
}
|
||||
@@ -299,7 +300,7 @@ namespace templating
|
||||
const auto isValidRedefinition = existingVariation->second->GetVariationType() == TemplatingVariationType::OPTIONS;
|
||||
|
||||
if (!isValidRedefinition)
|
||||
std::cerr << "Redefinition of \"" << optionsName << "\" as options is invalid\n";
|
||||
con::error("Redefinition of \"{}\" as options is invalid", optionsName);
|
||||
|
||||
return isValidRedefinition;
|
||||
}
|
||||
@@ -337,7 +338,7 @@ namespace templating
|
||||
{
|
||||
if (m_write_output_to_file)
|
||||
{
|
||||
std::cerr << "Cannot skip when already writing to file\n";
|
||||
con::error("Cannot skip when already writing to file");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -355,7 +356,7 @@ namespace templating
|
||||
m_output_stream = std::ofstream(m_output_file, std::ios::out | std::ios::binary);
|
||||
if (!m_output_stream.is_open())
|
||||
{
|
||||
std::cerr << "Failed to open output file \"" << m_output_file << "\"\n";
|
||||
con::error("Failed to open output file \"{}\"", m_output_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -412,7 +413,7 @@ bool Templater::TemplateToDirectory(const std::string& outputDirectory) const
|
||||
}
|
||||
catch (ParsingException& e)
|
||||
{
|
||||
std::cerr << "Error: " << e.FullMessage() << "\n";
|
||||
con::error(e.FullMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user