otel
parent
685753b217
commit
3f83c04b8c
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
include(cmake/color.cmake)
|
||||
set(BLT_VERSION 5.2.34)
|
||||
set(BLT_VERSION 5.2.35)
|
||||
|
||||
set(BLT_TARGET BLT)
|
||||
|
||||
|
@ -13,6 +13,7 @@ option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
|||
option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF)
|
||||
|
||||
option(BLT_DEBUG_OTEL "Enable OpenTelemetry Service" OFF)
|
||||
option(BLT_LOGGING_THREAD_SAFE "Make sure logging is thread synced" ON)
|
||||
|
||||
option(BUILD_STD "Build the BLT standard utilities." ON)
|
||||
option(BUILD_PROFILING "Build the BLT profiler extension" ON)
|
||||
|
@ -48,6 +49,10 @@ if (BLT_DEBUG_OTEL)
|
|||
# include_directories("${opentelemtry-cpp_INCLUDE_DIRS}")
|
||||
endif ()
|
||||
|
||||
if (BLT_LOGGING_THREAD_SAFE)
|
||||
add_compile_definitions(BLT_LOGGING_THREAD_SAFE)
|
||||
endif ()
|
||||
|
||||
if(${BLT_DISABLE_STATS})
|
||||
add_compile_definitions(BLT_DISABLE_STATS)
|
||||
endif ()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 154c63489e84d5569d3b466342a2ae8fd99e4734
|
||||
Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6
|
|
@ -33,6 +33,9 @@ namespace blt::logging
|
|||
};
|
||||
|
||||
static global_context_t global_context;
|
||||
#ifdef BLT_LOGGING_THREAD_SAFE
|
||||
static std::mutex global_logging_mutex;
|
||||
#endif
|
||||
|
||||
struct logging_thread_context_t
|
||||
{
|
||||
|
@ -237,6 +240,9 @@ namespace blt::logging
|
|||
|
||||
void print(std::string str)
|
||||
{
|
||||
#ifdef BLT_LOGGING_THREAD_SAFE
|
||||
std::scoped_lock lock{global_logging_mutex};
|
||||
#endif
|
||||
const auto& config = get_global_config();
|
||||
bool should_print = true;
|
||||
if (!config.get_injectors().empty())
|
||||
|
@ -257,6 +263,9 @@ namespace blt::logging
|
|||
|
||||
void newline()
|
||||
{
|
||||
#ifdef BLT_LOGGING_THREAD_SAFE
|
||||
std::scoped_lock lock{global_logging_mutex};
|
||||
#endif
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue