Replaced Logger usage with LOG_x (#548)
This commit is contained in:
committed by
GitHub
parent
ecad2248d9
commit
9d5993930d
@@ -1,11 +1,11 @@
|
||||
#include <Tactility/app/files/State.h>
|
||||
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/MountPoints.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
#include <Tactility/kernel/Platform.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <dirent.h>
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace tt::app::files {
|
||||
|
||||
static const auto LOGGER = Logger("Files");
|
||||
constexpr auto* TAG = "Files";
|
||||
|
||||
State::State() {
|
||||
if (kernel::getPlatform() == kernel::PlatformSimulator) {
|
||||
@@ -22,7 +22,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 {
|
||||
@@ -37,11 +37,11 @@ std::string State::getSelectedChildPath() const {
|
||||
bool State::setEntriesForPath(const std::string& path) {
|
||||
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;
|
||||
}
|
||||
|
||||
LOGGER.info("Changing path: {} -> {}", current_path, path);
|
||||
LOG_I(TAG, "Changing path: %s -> %s", current_path.c_str(), path.c_str());
|
||||
|
||||
/**
|
||||
* On PC, the root entry point ("/") is a folder.
|
||||
@@ -49,7 +49,7 @@ bool State::setEntriesForPath(const std::string& path) {
|
||||
*/
|
||||
bool get_mount_points = (kernel::getPlatform() == kernel::PlatformEsp) && (path == "/");
|
||||
if (get_mount_points) {
|
||||
LOGGER.info("Setting custom root");
|
||||
LOG_I(TAG, "Setting custom root");
|
||||
dir_entries = file::getFileSystemDirents();
|
||||
current_path = path;
|
||||
selected_child_entry = "";
|
||||
@@ -59,13 +59,13 @@ 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 = "";
|
||||
action = ActionNone;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,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