Replaced Logger usage with LOG_x (#548)

This commit is contained in:
Ken Van Hoeylandt
2026-07-04 23:49:19 +02:00
committed by GitHub
parent ecad2248d9
commit 9d5993930d
162 changed files with 1776 additions and 1842 deletions
@@ -1,20 +0,0 @@
/**
* Contains common log messages.
* This helps to keep the binary smaller.
*/
#pragma once
// Crashes
#define LOG_MESSAGE_ILLEGAL_STATE "Illegal state"
// Alloc
#define LOG_MESSAGE_ALLOC_FAILED "Out of memory"
#define LOG_MESSAGE_ALLOC_FAILED_FMT "Out of memory (failed to allocated {} bytes)"
// Mutex
#define LOG_MESSAGE_MUTEX_LOCK_FAILED "Mutex acquisition timeout"
#define LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT "Mutex acquisition timeout ({})"
// Power on
#define LOG_MESSAGE_POWER_ON_START "Power on"
#define LOG_MESSAGE_POWER_ON_FAILED "Power on failed"
-70
View File
@@ -1,70 +0,0 @@
#pragma once
#include <tactility/log.h>
#include <format>
namespace tt {
class Logger {
const char* tag;
LogLevel level = LOG_LEVEL_INFO;
public:
explicit Logger(const char* tag) : tag(tag) {}
template <typename... Args>
void verbose(std::format_string<Args...> format, Args&&... args) const {
std::string message = std::format(format, std::forward<Args>(args)...);
LOG_V(tag, "%s", message.c_str());
}
template <typename... Args>
void debug(std::format_string<Args...> format, Args&&... args) const {
std::string message = std::format(format, std::forward<Args>(args)...);
LOG_D(tag, "%s", message.c_str());
}
template <typename... Args>
void info(std::format_string<Args...> format, Args&&... args) const {
std::string message = std::format(format, std::forward<Args>(args)...);
LOG_I(tag, "%s", message.c_str());
}
template <typename... Args>
void warn(std::format_string<Args...> format, Args&&... args) const {
std::string message = std::format(format, std::forward<Args>(args)...);
LOG_W(tag, "%s", message.c_str());
}
template <typename... Args>
void error(std::format_string<Args...> format, Args&&... args) const {
std::string message = std::format(format, std::forward<Args>(args)...);
LOG_E(tag, "%s", message.c_str());
}
bool isLoggingVerbose() const {
return LOG_LEVEL_VERBOSE <= level;
}
bool isLoggingDebug() const {
return LOG_LEVEL_DEBUG <= level;
}
bool isLoggingInfo() const {
return LOG_LEVEL_INFO <= level;
}
bool isLoggingWarning() const {
return LOG_LEVEL_WARNING <= level;
}
bool isLoggingError() const {
return LOG_LEVEL_ERROR <= level;
}
};
}
@@ -3,4 +3,3 @@
#include <cstdio>
#include "CoreDefines.h"
#include "Logger.h"