mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Remove log statements that don't add much
This commit is contained in:
+4
-11
@@ -141,11 +141,6 @@ void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
currentGroup = 0;
|
||||
}
|
||||
|
||||
if (logger) {
|
||||
logger->trace(
|
||||
"Adding plugin {} to loading group {}", plugin.second, currentGroup);
|
||||
}
|
||||
|
||||
pluginGroups[currentGroup].push_back(plugin.second);
|
||||
++currentGroup;
|
||||
}
|
||||
@@ -167,13 +162,11 @@ void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
vector<string>& pluginGroup = pluginGroups[threads.size()];
|
||||
threads.push_back(thread([&]() {
|
||||
for (auto pluginName : pluginGroup) {
|
||||
if (logger) {
|
||||
logger->trace("Loading {}", pluginName);
|
||||
}
|
||||
auto pluginPath = DataPath() / u8path(pluginName);
|
||||
const bool loadHeader =
|
||||
loadHeadersOnly || loot::equivalent(pluginPath, masterPath);
|
||||
try {
|
||||
auto pluginPath = DataPath() / u8path(pluginName);
|
||||
const bool loadHeader =
|
||||
loadHeadersOnly || loot::equivalent(pluginPath, masterPath);
|
||||
|
||||
cache_->AddPlugin(Plugin(
|
||||
Type(), cache_, pluginPath, loadHeader));
|
||||
} catch (std::exception& e) {
|
||||
|
||||
@@ -84,7 +84,7 @@ void LoadOrderHandler::Init(const GameType& gameType,
|
||||
void LoadOrderHandler::LoadCurrentState() {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->debug("Loading the current load order state.");
|
||||
logger->info("Loading the current load order state.");
|
||||
}
|
||||
|
||||
unsigned int ret = lo_load_current_state(gh_);
|
||||
@@ -95,7 +95,7 @@ void LoadOrderHandler::LoadCurrentState() {
|
||||
bool LoadOrderHandler::IsPluginActive(const std::string& pluginName) const {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->debug("Checking if plugin \"{}\" is active.", pluginName);
|
||||
logger->trace("Checking if plugin \"{}\" is active.", pluginName);
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
@@ -109,7 +109,7 @@ bool LoadOrderHandler::IsPluginActive(const std::string& pluginName) const {
|
||||
std::vector<std::string> LoadOrderHandler::GetLoadOrder() const {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->debug("Getting load order.");
|
||||
logger->trace("Getting load order.");
|
||||
}
|
||||
|
||||
char** pluginArr;
|
||||
@@ -128,7 +128,7 @@ std::vector<std::string> LoadOrderHandler::GetLoadOrder() const {
|
||||
std::vector<std::string> LoadOrderHandler::GetActivePlugins() const {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->debug("Getting active plugins.");
|
||||
logger->trace("Getting active plugins.");
|
||||
}
|
||||
|
||||
char** pluginArr;
|
||||
@@ -148,7 +148,7 @@ std::vector<std::string> LoadOrderHandler::GetActivePlugins() const {
|
||||
std::vector<std::string> LoadOrderHandler::GetImplicitlyActivePlugins() const {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->debug("Getting implicitly active plugins.");
|
||||
logger->trace("Getting implicitly active plugins.");
|
||||
}
|
||||
|
||||
char** pluginArr;
|
||||
|
||||
@@ -78,10 +78,6 @@ std::vector<MessageContent> PluginCleaningData::GetInfo() const {
|
||||
|
||||
MessageContent PluginCleaningData::ChooseInfo(
|
||||
const std::string& language) const {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->trace("Choosing dirty info content.");
|
||||
}
|
||||
return MessageContent::Choose(info_, language);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,6 @@ PluginMetadata::PluginMetadata(const std::string& n) :
|
||||
}
|
||||
|
||||
void PluginMetadata::MergeMetadata(const PluginMetadata& plugin) {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->trace("Merging metadata for: {}", name_);
|
||||
}
|
||||
|
||||
if (plugin.HasNameOnly())
|
||||
return;
|
||||
|
||||
@@ -96,11 +91,6 @@ void PluginMetadata::MergeMetadata(const PluginMetadata& plugin) {
|
||||
PluginMetadata PluginMetadata::NewMetadata(const PluginMetadata& plugin) const {
|
||||
using std::set_difference;
|
||||
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->trace("Comparing new metadata for: {}", name_);
|
||||
}
|
||||
|
||||
PluginMetadata p(*this);
|
||||
|
||||
if (p.group_ == plugin.group_) {
|
||||
|
||||
+30
-51
@@ -60,35 +60,20 @@ Plugin::Plugin(const GameType gameType,
|
||||
|
||||
auto ret = esp_plugin_is_empty(esPlugin.get(), &isEmpty_);
|
||||
if (ret != ESP_OK) {
|
||||
throw FileAccessError(name_ +
|
||||
" : esplugin error code: " + std::to_string(ret));
|
||||
throw FileAccessError("Error checking if \"" + name_ + "\" is empty. esplugin error code: " + std::to_string(ret));
|
||||
}
|
||||
|
||||
if (!headerOnly) {
|
||||
if (logger) {
|
||||
logger->trace("{}: Caching CRC value.", name_);
|
||||
}
|
||||
crc_ = GetCrc32(pluginPath);
|
||||
|
||||
if (logger) {
|
||||
logger->trace("{}: Counting override FormIDs.", name_);
|
||||
}
|
||||
ret = esp_plugin_count_override_records(esPlugin.get(),
|
||||
&numOverrideRecords_);
|
||||
if (ret != ESP_OK) {
|
||||
throw FileAccessError(name_ +
|
||||
" : esplugin error code: " + std::to_string(ret));
|
||||
throw FileAccessError("Error counting override records in \"" + name_ + "\". esplugin error code: " + std::to_string(ret));
|
||||
}
|
||||
}
|
||||
|
||||
// Also read Bash Tags applied and version string in description.
|
||||
if (logger) {
|
||||
logger->trace("{}: Attempting to extract Bash Tags from the description.",
|
||||
name_);
|
||||
}
|
||||
|
||||
tags_ = ExtractBashTags(GetDescription());
|
||||
|
||||
loadsArchive_ = LoadsArchive(gameType, gameCache, pluginPath);
|
||||
} catch (std::exception& e) {
|
||||
if (logger) {
|
||||
@@ -97,10 +82,6 @@ Plugin::Plugin(const GameType gameType,
|
||||
}
|
||||
throw FileAccessError("Cannot read \"" + name_ + "\". Details: " + e.what());
|
||||
}
|
||||
|
||||
if (logger) {
|
||||
logger->trace("{}: Plugin loading complete.", name_);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Plugin::GetName() const { return name_; }
|
||||
@@ -206,41 +187,35 @@ size_t Plugin::NumOverrideFormIDs() const { return numOverrideRecords_; }
|
||||
|
||||
bool Plugin::IsValid(const GameType gameType,
|
||||
const std::filesystem::path& pluginPath) {
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->trace("Checking to see if \"{}\" is a valid plugin.", pluginPath.filename().u8string());
|
||||
}
|
||||
|
||||
// If the filename passed ends in '.ghost', that should be trimmed.
|
||||
std::string trimmedFilename = pluginPath.filename().u8string();
|
||||
if (boost::iends_with(trimmedFilename, ".ghost")) {
|
||||
trimmedFilename = trimmedFilename.substr(0, trimmedFilename.length() - 6);
|
||||
}
|
||||
|
||||
// Check that the file has a valid extension.
|
||||
if (!hasPluginFileExtension(trimmedFilename, gameType))
|
||||
return false;
|
||||
if (hasPluginFileExtension(pluginPath.filename().u8string(), gameType)) {
|
||||
bool isValid;
|
||||
int returnCode = esp_plugin_is_valid(GetEspluginGameId(gameType),
|
||||
pluginPath.u8string().c_str(),
|
||||
true,
|
||||
&isValid);
|
||||
|
||||
bool isValid;
|
||||
int ret = esp_plugin_is_valid(
|
||||
GetEspluginGameId(gameType), pluginPath.u8string().c_str(), true, &isValid);
|
||||
if (returnCode != ESP_OK || !isValid) {
|
||||
// Try adding .ghost extension.
|
||||
auto ghostedFilename = pluginPath.u8string() + ".ghost";
|
||||
returnCode = esp_plugin_is_valid(GetEspluginGameId(gameType),
|
||||
ghostedFilename.c_str(),
|
||||
true,
|
||||
&isValid);
|
||||
}
|
||||
|
||||
if (ret != ESP_OK || !isValid) {
|
||||
// Try adding .ghost extension.
|
||||
auto ghostedPath = pluginPath;
|
||||
ghostedPath += ".ghost";
|
||||
|
||||
ret = esp_plugin_is_valid(
|
||||
GetEspluginGameId(gameType), ghostedPath.u8string().c_str(), true, &isValid);
|
||||
}
|
||||
|
||||
if (ret != ESP_OK || !isValid) {
|
||||
if (logger) {
|
||||
logger->warn("The file \"{}\" is not a valid plugin.", pluginPath.filename().u8string());
|
||||
if (returnCode == ESP_OK && isValid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret == ESP_OK && isValid;
|
||||
auto logger = getLogger();
|
||||
if (logger) {
|
||||
logger->info("The file \"{}\" is not a valid plugin.",
|
||||
pluginPath.filename().u8string());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uintmax_t Plugin::GetFileSize(std::filesystem::path pluginPath) {
|
||||
@@ -380,7 +355,11 @@ unsigned int Plugin::GetEspluginGameId(GameType gameType) {
|
||||
}
|
||||
}
|
||||
|
||||
bool hasPluginFileExtension(const std::string& filename, GameType gameType) {
|
||||
bool hasPluginFileExtension(std::string filename, GameType gameType) {
|
||||
if (boost::iends_with(filename, ".ghost")) {
|
||||
filename = filename.substr(0, filename.length() - 6);
|
||||
}
|
||||
|
||||
bool espOrEsm = boost::iends_with(filename, ".esp") ||
|
||||
boost::iends_with(filename, ".esm");
|
||||
bool lightMaster =
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ private:
|
||||
|
||||
std::string GetArchiveFileExtension(const GameType gameType);
|
||||
|
||||
bool hasPluginFileExtension(const std::string& filename, GameType gameType);
|
||||
bool hasPluginFileExtension(std::string filename, GameType gameType);
|
||||
|
||||
bool equivalent(const std::filesystem::path& path1, const std::filesystem::path& path2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user