Replaced Logger usage with LOG_x (#548)
This commit is contained in:
committed by
GitHub
parent
ecad2248d9
commit
9d5993930d
@@ -1,19 +1,19 @@
|
||||
#include "Tactility/app/fileselection/State.h"
|
||||
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/MountPoints.h>
|
||||
#include <Tactility/kernel/Platform.h>
|
||||
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <cstring>
|
||||
#include <dirent.h>
|
||||
#include <tactility/log.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
namespace tt::app::fileselection {
|
||||
|
||||
static const auto LOGGER = Logger("FileSelection");
|
||||
constexpr auto* TAG = "FileSelection";
|
||||
|
||||
State::State() {
|
||||
if (kernel::getPlatform() == kernel::PlatformSimulator) {
|
||||
@@ -21,7 +21,7 @@ State::State() {
|
||||
if (getcwd(cwd, sizeof(cwd)) != nullptr) {
|
||||
setEntriesForPath(cwd);
|
||||
} else {
|
||||
LOGGER.error("Failed to get current work directory files");
|
||||
LOG_E(TAG, "Failed to get current work directory files");
|
||||
setEntriesForPath("/");
|
||||
}
|
||||
} else {
|
||||
@@ -34,11 +34,11 @@ std::string State::getSelectedChildPath() const {
|
||||
}
|
||||
|
||||
bool State::setEntriesForPath(const std::string& path) {
|
||||
LOGGER.info("Changing path: {} -> {}", current_path, path);
|
||||
LOG_I(TAG, "Changing path: %s -> %s", current_path.c_str(), path.c_str());
|
||||
|
||||
auto lock = mutex.asScopedLock();
|
||||
if (!lock.lock(100)) {
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "setEntriesForPath");
|
||||
LOG_E(TAG, "Mutex acquisition timeout (%s)", "setEntriesForPath");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ bool State::setEntriesForPath(const std::string& path) {
|
||||
*/
|
||||
bool show_custom_root = (kernel::getPlatform() == kernel::PlatformEsp) && (path == "/");
|
||||
if (show_custom_root) {
|
||||
LOGGER.info("Setting custom root");
|
||||
LOG_I(TAG, "Setting custom root");
|
||||
dir_entries = file::getFileSystemDirents();
|
||||
current_path = path;
|
||||
selected_child_entry = "";
|
||||
@@ -57,12 +57,12 @@ bool State::setEntriesForPath(const std::string& path) {
|
||||
dir_entries.clear();
|
||||
int count = file::scandir(path, dir_entries, &file::direntFilterDotEntries, file::direntSortAlphaAndType);
|
||||
if (count >= 0) {
|
||||
LOGGER.info("{} has {} entries", path, count);
|
||||
LOG_I(TAG, "%s has %d entries", path.c_str(), count);
|
||||
current_path = path;
|
||||
selected_child_entry = "";
|
||||
return true;
|
||||
} else {
|
||||
LOGGER.error("Failed to fetch entries for {}", path);
|
||||
LOG_E(TAG, "Failed to fetch entries for %s", path.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ bool State::setEntriesForPath(const std::string& path) {
|
||||
|
||||
bool State::setEntriesForChildPath(const std::string& childPath) {
|
||||
auto path = file::getChildPath(current_path, childPath);
|
||||
LOGGER.info("Navigating from {} to {}", current_path, path);
|
||||
LOG_I(TAG, "Navigating from %s to %s", current_path.c_str(), path.c_str());
|
||||
return setEntriesForPath(path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user