diff --git a/Makefile b/Makefile index 2239130..a830a6e 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ OS = linux # C++ compier CXX = g++ -CXXFLAGS = -MMD -c -g -Og -Wall -Werror -std=c++11 -Iinclude -Isrc/asm/include #-fsanitize=thread -fPIE +CXXFLAGS = -MMD -c -g -Og -Wall -Werror -std=c++11 -Iinclude -Isrc/asm/include -fno-strict-aliasing #-fsanitize=thread -fPIE LDFLAGS = -lgtest #-ltsan -pie # Archiver diff --git a/include/logger.h b/include/logger.h index fe46a6d..ea5a7c8 100644 --- a/include/logger.h +++ b/include/logger.h @@ -23,19 +23,23 @@ public: template void log(const char* s, const Args&... args) { - std::cout << "step 1" << std::endl; + //const long time = std::chrono::high_resolution_clock::now().time_since_epoch().count(); + if(_enabled) { - std::cout << "step 2" << std::endl; - _queue.add_log([this, s, args...] { - std::cout << "step 3" << std::endl; - _logLine.str(""); - log_internal(s, args...); - }); + const std::function& func = std::bind(&logger::log_impl, this, s, args...); + _queue.add_log(func); } } private: + + template void log_impl(const char* s, const Args&... args) + { + _logLine.str(""); + log_internal(s, args...); + } + void log_internal(const char* s); template void log_internal(const char* s, const T& value, const Args&... args)