Replaced Logger usage with LOG_x (#548)
This commit is contained in:
committed by
GitHub
parent
ecad2248d9
commit
9d5993930d
@@ -1,4 +1,3 @@
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
@@ -8,11 +7,13 @@
|
||||
|
||||
#include "Tactility/Paths.h"
|
||||
|
||||
#include <tactility/log.h>
|
||||
|
||||
#include <format>
|
||||
|
||||
namespace tt::settings {
|
||||
|
||||
static const auto LOGGER = Logger("SystemSettings");
|
||||
constexpr auto* TAG = "SystemSettings";
|
||||
|
||||
constexpr auto* FILE_PATH_FORMAT = "{}/settings/system.properties";
|
||||
|
||||
@@ -26,7 +27,7 @@ static bool hasSystemSettingsFile() {
|
||||
|
||||
static bool loadSystemSettingsFromFile(SystemSettings& properties) {
|
||||
auto file_path = std::format(FILE_PATH_FORMAT, getUserDataPath());
|
||||
LOGGER.info("System settings loading from {}", file_path);
|
||||
LOG_I(TAG, "System settings loading from %s", file_path.c_str());
|
||||
std::map<std::string, std::string> map;
|
||||
if (!file::loadPropertiesFile(file_path, map)) {
|
||||
return false;
|
||||
@@ -35,7 +36,7 @@ static bool loadSystemSettingsFromFile(SystemSettings& properties) {
|
||||
auto language_entry = map.find("language");
|
||||
if (language_entry != map.end()) {
|
||||
if (!fromString(language_entry->second, properties.language)) {
|
||||
LOGGER.warn("Unknown language \"{}\" in {}", language_entry->second, file_path);
|
||||
LOG_W(TAG, "Unknown language \"%s\" in %s", language_entry->second.c_str(), file_path.c_str());
|
||||
properties.language = Language::en_US;
|
||||
}
|
||||
} else {
|
||||
@@ -52,11 +53,11 @@ static bool loadSystemSettingsFromFile(SystemSettings& properties) {
|
||||
if (date_format_entry != map.end() && !date_format_entry->second.empty()) {
|
||||
properties.dateFormat = date_format_entry->second;
|
||||
} else {
|
||||
LOGGER.info("dateFormat missing or empty, using default MM/DD/YYYY (likely from older system.properties)");
|
||||
LOG_I(TAG, "dateFormat missing or empty, using default MM/DD/YYYY (likely from older system.properties)");
|
||||
properties.dateFormat = "MM/DD/YYYY";
|
||||
}
|
||||
|
||||
LOGGER.info("System settings loaded");
|
||||
LOG_I(TAG, "System settings loaded");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ bool loadSystemSettings(SystemSettings& properties) {
|
||||
if (loadSystemSettingsFromFile(cachedSettings)) {
|
||||
cached = true;
|
||||
} else {
|
||||
LOGGER.error("Failed to load");
|
||||
LOG_E(TAG, "Failed to load");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,12 +82,12 @@ bool saveSystemSettings(const SystemSettings& properties) {
|
||||
map["dateFormat"] = properties.dateFormat;
|
||||
|
||||
if (!file::findOrCreateParentDirectory(file_path, 0755)) {
|
||||
LOGGER.error("Failed to create parent dir for {}", file_path);
|
||||
LOG_E(TAG, "Failed to create parent dir for %s", file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!file::savePropertiesFile(file_path, map)) {
|
||||
LOGGER.error("Failed to save {}", file_path);
|
||||
LOG_E(TAG, "Failed to save %s", file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user