This commit is contained in:
2025-02-18 19:00:01 +01:00
parent e39f8de898
commit 044b12cdec
17 changed files with 301 additions and 556 deletions

View File

@@ -4,9 +4,6 @@
#include <iomanip>
#include <sstream>
#include <sp/misc/Format.h>
#include <sp/misc/Log.h>
namespace sp {
DataBuffer::DataBuffer() : m_ReadOffset(0) {}
@@ -142,7 +139,7 @@ bool DataBuffer::ReadFile(const std::string& fileName) {
m_Buffer = DataBuffer::Data(s.begin(), s.end());
m_ReadOffset = 0;
} catch (std::exception& e) {
utils::LOGE(utils::Format("[IO] Failed to read file %s ! reason : %s", fileName.c_str(), e.what()));
// utils::LOGE(utils::Format("[IO] Failed to read file %s ! reason : %s", fileName.c_str(), e.what()));
return false;
}
return m_Buffer.size() > 0;
@@ -154,7 +151,7 @@ bool DataBuffer::WriteFile(const std::string& fileName) const {
file.write(reinterpret_cast<const char*>(m_Buffer.data()), static_cast<std::streamsize>(m_Buffer.size()));
file.flush();
} catch (std::exception& e) {
utils::LOGE(utils::Format("[IO] Failed to read file %s ! reason : %s", fileName.c_str(), e.what()));
// utils::LOGE(utils::Format("[IO] Failed to read file %s ! reason : %s", fileName.c_str(), e.what()));
return false;
}
return true;

View File

@@ -1,37 +0,0 @@
#include <sp/misc/Log.h>
#ifdef SP_ANDROID_LOGGING
#include <android/log.h>
#else
#include <iostream>
#endif
namespace sp {
namespace utils {
void LOG(const std::string& msg) {
#ifdef SP_ANDROID_LOGGING
__android_log_print(ANDROID_LOG_INFO, "TRACKERS", "%s", msg.c_str());
#else
std::cout << msg << "\n";
#endif
}
void LOGD(const std::string& msg) {
#if !defined(NDEBUG)
LOG(msg);
#endif
}
void LOGE(const std::string& err) {
#ifdef SP_ANDROID_LOGGING
__android_log_print(ANDROID_LOG_ERROR, "TRACKERS", "%s", err.c_str());
#else
std::cerr << err << "\n";
#endif
}
} // namespace utils
} // namespace sp

View File

@@ -1,14 +0,0 @@
#include <sp/misc/Format.h>
#include <sp/misc/Log.h>
#include <sp/misc/Test.h>
namespace sp {
namespace test {
void LogAssert(const char* expression, const char* file, int line, const char* function) {
utils::LOGE(utils::Format("%s:%i: %s: Assertion failed !", file, line, function));
utils::LOGE(utils::Format(" %i |\t%s;", line, expression));
}
} // namespace test
} // namespace sp