fix: Rewrite Logger to use platform NSLog / __android_log_print (#54)

* fix: Fix wrong include..?

* fix: Reimplement NitroLogger as a platform-specific logger

* fix: Copy args, and use proper tag

* fix: Fix sprintf crash because of wrong format argument

* fix: Fix Logger usage on iOS
This commit is contained in:
Marc Rousavy
2024-08-20 16:20:44 +02:00
committed by GitHub
parent acca5baaa4
commit e7b9f412eb
18 changed files with 166 additions and 87 deletions
@@ -12,7 +12,7 @@
namespace margelo::nitro {
ThreadPool::ThreadPool(const char* name, size_t numThreads) : _isAlive(true), _name(name) {
Logger::log(TAG, "Creating ThreadPool \"%s\" with %i threads...", name, numThreads);
Logger::log(LogLevel::Info, TAG, "Creating ThreadPool \"%s\" with %i threads...", name, numThreads);
for (size_t i = 0; i < numThreads; ++i) {
std::string threadName = std::string(name) + "-" + std::to_string(i + 1);
@@ -56,7 +56,7 @@ void ThreadPool::run(std::function<void()>&& task) {
}
ThreadPool::~ThreadPool() {
Logger::log(TAG, "Destroying ThreadPool \"%s\"...", _name);
Logger::log(LogLevel::Info, TAG, "Destroying ThreadPool \"%s\"...", _name);
{
// Lock and set `_isAlive` to false.