Replaced Logger usage with LOG_x (#548)
This commit is contained in:
committed by
GitHub
parent
ecad2248d9
commit
9d5993930d
@@ -7,11 +7,13 @@
|
||||
|
||||
#include <Tactility/MountPoints.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/service/wifi/WifiApSettings.h>
|
||||
|
||||
#include <Tactility/Paths.h>
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <tactility/log.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <format>
|
||||
#include <map>
|
||||
@@ -20,7 +22,7 @@
|
||||
|
||||
namespace tt::service::wifi {
|
||||
|
||||
static const auto LOGGER = Logger("WifiBootSplashInit");
|
||||
constexpr auto* TAG = "WifiBootSplashInit";
|
||||
|
||||
constexpr auto* AP_PROPERTIES_KEY_SSID = "ssid";
|
||||
constexpr auto* AP_PROPERTIES_KEY_PASSWORD = "password";
|
||||
@@ -39,13 +41,13 @@ struct ApProperties {
|
||||
static void importWifiAp(const std::string& filePath) {
|
||||
std::map<std::string, std::string> map;
|
||||
if (!file::loadPropertiesFile(filePath, map)) {
|
||||
LOGGER.error("Failed to load AP properties at {}", filePath);
|
||||
LOG_E(TAG, "Failed to load AP properties at %s", filePath.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
const auto ssid_iterator = map.find(AP_PROPERTIES_KEY_SSID);
|
||||
if (ssid_iterator == map.end()) {
|
||||
LOGGER.error("{} is missing ssid", filePath);
|
||||
LOG_E(TAG, "%s is missing ssid", filePath.c_str());
|
||||
return;
|
||||
}
|
||||
const auto ssid = ssid_iterator->second;
|
||||
@@ -69,18 +71,18 @@ static void importWifiAp(const std::string& filePath) {
|
||||
);
|
||||
|
||||
if (!settings::save(settings)) {
|
||||
LOGGER.error("Failed to save settings for {}", ssid);
|
||||
LOG_E(TAG, "Failed to save settings for %s", ssid.c_str());
|
||||
} else {
|
||||
LOGGER.info("Imported {} from {}", ssid, filePath);
|
||||
LOG_I(TAG, "Imported %s from %s", ssid.c_str(), filePath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
const auto auto_remove_iterator = map.find(AP_PROPERTIES_KEY_AUTO_REMOVE);
|
||||
if (auto_remove_iterator != map.end() && auto_remove_iterator->second == "true") {
|
||||
if (!remove(filePath.c_str())) {
|
||||
LOGGER.error("Failed to auto-remove {}", filePath);
|
||||
LOG_E(TAG, "Failed to auto-remove %s", filePath.c_str());
|
||||
} else {
|
||||
LOGGER.info("Auto-removed {}", filePath);
|
||||
LOG_I(TAG, "Auto-removed %s", filePath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +111,7 @@ static void importWifiApSettingsFromDir(const std::string& path) {
|
||||
}
|
||||
|
||||
if (dirent_list.empty()) {
|
||||
LOGGER.warn("No AP files found at {}", path);
|
||||
LOG_W(TAG, "No AP files found at %s", path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -120,24 +122,24 @@ static void importWifiApSettingsFromDir(const std::string& path) {
|
||||
}
|
||||
|
||||
void bootSplashInit() {
|
||||
LOGGER.info("bootSplashInit dispatch");
|
||||
LOG_I(TAG, "bootSplashInit dispatch");
|
||||
getMainDispatcher().dispatch([] {
|
||||
LOGGER.info("bootSplashInit dispatch begin");
|
||||
LOG_I(TAG, "bootSplashInit dispatch begin");
|
||||
// Import any provisioning files placed on the system data partition.
|
||||
const std::string provisioning_path = file::getChildPath(getUserDataPath(), "provisioning");
|
||||
if (file::isDirectory(provisioning_path)) {
|
||||
importWifiApSettingsFromDir(provisioning_path);
|
||||
} else {
|
||||
LOGGER.info("Skip provisioning: no files at {}", provisioning_path);
|
||||
LOG_I(TAG, "Skip provisioning: no files at %s", provisioning_path.c_str());
|
||||
}
|
||||
|
||||
// Dispatch WiFi on
|
||||
if (settings::shouldEnableOnBoot()) {
|
||||
LOGGER.info("Auto-enabling WiFi");
|
||||
LOG_I(TAG, "Auto-enabling WiFi");
|
||||
getMainDispatcher().dispatch([] -> void { setEnabled(true); });
|
||||
}
|
||||
|
||||
LOGGER.info("bootSplashInit dispatch end");
|
||||
LOG_I(TAG, "bootSplashInit dispatch end");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user