diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c9b99c..d42bc5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,9 +83,9 @@ if ((NOT TARGET macro_utils_c) AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/macro- include_directories(${MACRO_UTILS_INC_FOLDER}) endif() -if ((NOT TARGET c_logging) AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/c-logging/CMakeLists.txt)) +if ((NOT TARGET c_logging_v2) AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/c-logging/CMakeLists.txt)) add_subdirectory(deps/c-logging) - include_directories(deps/c-logging/inc) + include_directories(deps/c-logging/v2/inc) endif() if ((NOT TARGET ctest) AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/ctest/CMakeLists.txt)) diff --git a/build_functions/c-pal_suppressions.sup b/build_functions/c-pal_suppressions.sup index 4acb926..52f7ca2 100644 --- a/build_functions/c-pal_suppressions.sup +++ b/build_functions/c-pal_suppressions.sup @@ -4,6 +4,15 @@ fun:thread_worker_func ... } +{ + + Helgrind:Race + ... + fun:__vfprintf_internal + ... + fun:log_sink_console_log + ... +} { Helgrind:Race diff --git a/c_pal_ll/interfaces/reals/CMakeLists.txt b/c_pal_ll/interfaces/reals/CMakeLists.txt index 19636d3..972d5f2 100644 --- a/c_pal_ll/interfaces/reals/CMakeLists.txt +++ b/c_pal_ll/interfaces/reals/CMakeLists.txt @@ -10,4 +10,4 @@ set(reals_pal_ll_h_files add_library(pal_ll_interfaces_reals INTERFACE) target_include_directories(pal_ll_interfaces_reals INTERFACE ${CMAKE_CURRENT_LIST_DIR}) -target_link_libraries(pal_ll_interfaces_reals INTERFACE c_logging) +target_link_libraries(pal_ll_interfaces_reals INTERFACE c_logging_v2) diff --git a/c_pal_ll/interfaces/tests/sync_int/sync_int.c b/c_pal_ll/interfaces/tests/sync_int/sync_int.c index 2c8f7cf..9d736d4 100644 --- a/c_pal_ll/interfaces/tests/sync_int/sync_int.c +++ b/c_pal_ll/interfaces/tests/sync_int/sync_int.c @@ -7,7 +7,7 @@ // IWYU pragma: no_include #include "testrunnerswitcher.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep diff --git a/c_pal_ll/linux/CMakeLists.txt b/c_pal_ll/linux/CMakeLists.txt index 529525d..6d5e5cf 100644 --- a/c_pal_ll/linux/CMakeLists.txt +++ b/c_pal_ll/linux/CMakeLists.txt @@ -18,7 +18,7 @@ include_directories(../interfaces/inc) add_library(pal_ll_linux ${pal_ll_linux_h_files} ${pal_ll_linux_c_files} ${pal_ll_linux_md_files}) set_target_properties(pal_ll_linux PROPERTIES LINKER_LANGUAGE C) -target_link_libraries(pal_ll_linux pal_interfaces rt pthread) +target_link_libraries(pal_ll_linux pal_interfaces rt pthread c_logging_v2) target_include_directories(pal_ll_linux PUBLIC ${CMAKE_CURRENT_LIST_DIR}/inc) # Set CMAKE_INSTALL_* if not defined diff --git a/c_pal_ll/linux/src/sync_linux.c b/c_pal_ll/linux/src/sync_linux.c index 807634e..2eab687 100644 --- a/c_pal_ll/linux/src/sync_linux.c +++ b/c_pal_ll/linux/src/sync_linux.c @@ -8,7 +8,7 @@ #include #include -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "sys/syscall.h" #include "linux/futex.h" diff --git a/c_pal_ll/linux/src/threadapi_pthreads.c b/c_pal_ll/linux/src/threadapi_pthreads.c index b7945c8..252b436 100644 --- a/c_pal_ll/linux/src/threadapi_pthreads.c +++ b/c_pal_ll/linux/src/threadapi_pthreads.c @@ -11,7 +11,7 @@ #include #include -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/threadapi.h" diff --git a/c_pal_ll/win32/CMakeLists.txt b/c_pal_ll/win32/CMakeLists.txt index d0dbdfa..91f7b29 100644 --- a/c_pal_ll/win32/CMakeLists.txt +++ b/c_pal_ll/win32/CMakeLists.txt @@ -23,7 +23,7 @@ add_library(pal_ll_win32 ${pal_ll_win32_h_files} ${pal_ll_win32_c_files} ${pal_l set_target_properties(pal_ll_win32 PROPERTIES LINKER_LANGUAGE C) -target_link_libraries(pal_ll_win32 pal_ll_interfaces synchronization rpcrt4 c_logging) +target_link_libraries(pal_ll_win32 pal_ll_interfaces synchronization rpcrt4 c_logging_v2) target_include_directories(pal_ll_win32 PUBLIC ${CMAKE_CURRENT_LIST_DIR}/inc ${CMAKE_CURRENT_LIST_DIR}/src) diff --git a/c_pal_ll/win32/src/sync_win32.c b/c_pal_ll/win32/src/sync_win32.c index 612c0cc..31f50f9 100644 --- a/c_pal_ll/win32/src/sync_win32.c +++ b/c_pal_ll/win32/src/sync_win32.c @@ -7,7 +7,7 @@ #include "windows.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/interlocked.h" #include "c_pal/sync.h" diff --git a/c_pal_ll/win32/src/threadapi_win32.c b/c_pal_ll/win32/src/threadapi_win32.c index 281ec8b..5bd4e6b 100644 --- a/c_pal_ll/win32/src/threadapi_win32.c +++ b/c_pal_ll/win32/src/threadapi_win32.c @@ -6,7 +6,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/threadapi.h" diff --git a/common/inc/c_pal/log_critical_and_terminate.h b/common/inc/c_pal/log_critical_and_terminate.h index caad5b7..91a114f 100644 --- a/common/inc/c_pal/log_critical_and_terminate.h +++ b/common/inc/c_pal/log_critical_and_terminate.h @@ -5,7 +5,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/ps_util.h" diff --git a/common/inc/c_pal/refcount.h b/common/inc/c_pal/refcount.h index 3c8c6a6..191676c 100644 --- a/common/inc/c_pal/refcount.h +++ b/common/inc/c_pal/refcount.h @@ -24,7 +24,7 @@ will interact with deallocated memory / resources resulting in an undefined beha #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" // Include the platform-specific file that defines atomic functionality #include "c_pal/gballoc_hl.h" diff --git a/common/inc/c_pal/thandle.h b/common/inc/c_pal/thandle.h index 8f0c929..17c3a2d 100644 --- a/common/inc/c_pal/thandle.h +++ b/common/inc/c_pal/thandle.h @@ -10,7 +10,7 @@ #include "macro_utils/macro_utils.h" #include "umock_c/umock_c_prod.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/interlocked.h" diff --git a/common/inc/c_pal/thandle_ll.h b/common/inc/c_pal/thandle_ll.h index 298e6e2..be4fdea 100644 --- a/common/inc/c_pal/thandle_ll.h +++ b/common/inc/c_pal/thandle_ll.h @@ -10,7 +10,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/interlocked.h" diff --git a/common/src/call_once.c b/common/src/call_once.c index 3da3c43..6b7d9c0 100644 --- a/common/src/call_once.c +++ b/common/src/call_once.c @@ -6,7 +6,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/interlocked.h" #include "c_pal/sync.h" diff --git a/common/src/interlocked_hl.c b/common/src/interlocked_hl.c index 73e9d7f..d2caf3d 100644 --- a/common/src/interlocked_hl.c +++ b/common/src/interlocked_hl.c @@ -6,7 +6,7 @@ #include "umock_c/umock_c_prod.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/interlocked.h" #include "c_pal/sync.h" diff --git a/common/src/lazy_init.c b/common/src/lazy_init.c index b9bea6f..4cd1bf6 100644 --- a/common/src/lazy_init.c +++ b/common/src/lazy_init.c @@ -6,7 +6,7 @@ #include "macro_utils/macro_utils.h" // for MU_COUNT_ARG_0, MU_DISPATCH_EMP... -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/call_once.h" diff --git a/common/src/s_list.c b/common/src/s_list.c index 8c5151f..2ab80cf 100644 --- a/common/src/s_list.c +++ b/common/src/s_list.c @@ -6,7 +6,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/s_list.h" diff --git a/common/src/sm.c b/common/src/sm.c index 5014202..567713a 100644 --- a/common/src/sm.c +++ b/common/src/sm.c @@ -9,7 +9,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" #include "c_pal/interlocked.h" diff --git a/common/tests/refcount_ut/some_refcount_impl.c b/common/tests/refcount_ut/some_refcount_impl.c index 1e215c7..8209c44 100644 --- a/common/tests/refcount_ut/some_refcount_impl.c +++ b/common/tests/refcount_ut/some_refcount_impl.c @@ -2,9 +2,13 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include + +#include "macro_utils/macro_utils.h" + #include "c_pal/refcount.h" #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep + #include "some_refcount_impl.h" typedef struct pos_TAG diff --git a/common/tests/sm_int/sm_int.c b/common/tests/sm_int/sm_int.c index 2465956..1667a08 100644 --- a/common/tests/sm_int/sm_int.c +++ b/common/tests/sm_int/sm_int.c @@ -11,6 +11,9 @@ #include "macro_utils/macro_utils.h" // IWYU pragma: keep +#include "c_logging/log_level.h" +#include "c_logging/logger.h" + #include "c_pal/timer.h" #include "c_pal/gballoc_hl.h" #include "c_pal/threadapi.h" @@ -18,7 +21,6 @@ #include "c_pal/sysinfo.h" // IWYU pragma: keep #include "c_pal/sync.h" // IWYU pragma: keep #include "c_pal/interlocked_hl.h" -#include "c_logging/xlogging.h" #include "c_pal/sm.h" @@ -843,8 +845,8 @@ At least 1 sm_open_begin and at least 1 sm_exec_begin are waited to happen*/ TEST_FUNCTION(sm_chaos) { LogInfo("disabling logging for the duration of sm_chaos. Logging takes additional locks that \"might\" help the test pass"); - LOGGER_LOG toBeRestored = xlogging_get_log_function(); - xlogging_set_log_function(NULL); + LOGGER_CONFIG old_config = logger_get_config(); + logger_set_config((LOGGER_CONFIG) { .log_sinks = NULL, .log_sink_count = 0 }); OPEN_CLOSE_THREADS* data = malloc(sizeof(OPEN_CLOSE_THREADS)); ASSERT_IS_NOT_NULL(data); @@ -907,7 +909,7 @@ TEST_FUNCTION(sm_chaos) ((n_begin_open_grants_local==0) || (n_begin_grants_local==0)) ) { - toBeRestored(AZ_LOG_INFO, __FILE__, FUNC_NAME, __LINE__, 0, "Slept %" PRIu32 " ms, no sign of n_begin_open_grants=%" PRId32 ", n_begin_grants=%" PRId32 "\n", counterSleep * 1000, n_begin_open_grants_local, n_begin_grants_local); + LOGGER_LOG_WITH_CONFIG(old_config, LOG_LEVEL_INFO, NULL, "Slept %" PRIu32 " ms, no sign of n_begin_open_grants=%" PRId32 ", n_begin_grants=%" PRId32 "\n", counterSleep * 1000, n_begin_open_grants_local, n_begin_grants_local); counterSleep++; ThreadAPI_Sleep(1000); } @@ -930,7 +932,7 @@ TEST_FUNCTION(sm_chaos) /*just in case anything needs to close*/ - toBeRestored(AZ_LOG_INFO, __FILE__, FUNC_NAME, __LINE__, 0, "nthreads=%" PRIu32 + LOGGER_LOG_WITH_CONFIG(old_config, LOG_LEVEL_INFO, NULL, "nthreads=%" PRIu32 ", n_begin_open_grants=%" PRIu32 ", n_begin_open_refuses=%" PRIu32 ", n_begin_close_grants=%" PRIu32 ", n_begin_close_refuses=%" PRIu32 ", n_begin_barrier_grants=%" PRIu32 ", n_begin_barrier_refuses=%" PRIu32 @@ -946,15 +948,14 @@ TEST_FUNCTION(sm_chaos) interlocked_add(&data->n_begin_barrier_refuses, 0), interlocked_add(&data->n_begin_grants, 0), interlocked_add(&data->n_begin_refuses, 0), - interlocked_add(&data->n_faults, 0) - ); + interlocked_add(&data->n_faults, 0)); ASSERT_IS_TRUE(interlocked_add(&data->n_begin_open_grants, 0) >= 1); } sm_destroy(data->sm); free(data); - xlogging_set_log_function(toBeRestored); + logger_set_config(old_config); } /*Same as the chaos test but faults occasionally happen @@ -962,8 +963,8 @@ Test waits for a fault to be called*/ TEST_FUNCTION(sm_chaos_with_faults) { LogInfo("disabling logging for the duration of sm_chaos. Logging takes additional locks that \"might\" help the test pass"); - LOGGER_LOG toBeRestored = xlogging_get_log_function(); - xlogging_set_log_function(NULL); + LOGGER_CONFIG old_config = logger_get_config(); + logger_set_config((LOGGER_CONFIG) { .log_sinks = NULL, .log_sink_count = 0 }); OPEN_CLOSE_THREADS* data = malloc(sizeof(OPEN_CLOSE_THREADS)); ASSERT_IS_NOT_NULL(data); @@ -1025,7 +1026,7 @@ TEST_FUNCTION(sm_chaos_with_faults) ((n_faults_local == 0)) ) { - toBeRestored(AZ_LOG_INFO, __FILE__, FUNC_NAME, __LINE__, 0, "Slept %" PRIu32 " ms, no sign of n_faults=%" PRId32 "\n", counterSleep * 1000, n_faults_local); + LOGGER_LOG_WITH_CONFIG(old_config, LOG_LEVEL_INFO, NULL, "Slept %" PRIu32 " ms, no sign of n_faults=%" PRId32 "\n", counterSleep * 1000, n_faults_local); counterSleep++; ThreadAPI_Sleep(1000); } @@ -1050,7 +1051,7 @@ TEST_FUNCTION(sm_chaos_with_faults) /*just in case anything needs to close*/ - toBeRestored(AZ_LOG_INFO, __FILE__, FUNC_NAME, __LINE__, 0, "nthreads=%" PRIu32 + LOGGER_LOG_WITH_CONFIG(old_config, LOG_LEVEL_INFO, NULL, "nthreads=%" PRIu32 ", n_begin_open_grants=%" PRIu32 ", n_begin_open_refuses=%" PRIu32 ", n_begin_close_grants=%" PRIu32 ", n_begin_close_refuses=%" PRIu32 ", n_begin_barrier_grants=%" PRIu32 ", n_begin_barrier_refuses=%" PRIu32 @@ -1074,15 +1075,15 @@ TEST_FUNCTION(sm_chaos_with_faults) sm_destroy(data->sm); free(data); - xlogging_set_log_function(toBeRestored); + logger_set_config(old_config); } #endif TEST_FUNCTION(sm_does_not_block) { LogInfo("disabling logging for the duration of sm_does_not_block. Logging takes additional locks that \"might help\" the test pass"); - LOGGER_LOG toBeRestored = xlogging_get_log_function(); - xlogging_set_log_function(NULL); + LOGGER_CONFIG old_config = logger_get_config(); + logger_set_config((LOGGER_CONFIG) { .log_sinks = NULL, .log_sink_count = 0 }); ///arrange THREADS_COMMON* data = malloc(sizeof(THREADS_COMMON)); @@ -1116,7 +1117,7 @@ TEST_FUNCTION(sm_does_not_block) ASSERT_IS_TRUE(sm_open_begin(data->sm) == SM_EXEC_GRANTED); sm_open_end(data->sm, true); - toBeRestored(AZ_LOG_INFO, __FILE__, FUNC_NAME, __LINE__, 0, "Info: nthreads=%" PRIu32 " n_barrier_threads=%" PRIu32 " n_non_barrier_threads=%" PRIu32 "\n", nthreads, n_barrier_threads, n_non_barrier_threads); + LOGGER_LOG_WITH_CONFIG(old_config, LOG_LEVEL_INFO, NULL, "Info: nthreads=%" PRIu32 " n_barrier_threads=%" PRIu32 " n_non_barrier_threads=%" PRIu32 "\n", nthreads, n_barrier_threads, n_non_barrier_threads); /*create them barrier threads*/ for (uint32_t iBarrier = 0; iBarrier < n_barrier_threads; iBarrier++) @@ -1151,7 +1152,7 @@ TEST_FUNCTION(sm_does_not_block) /*verify the all numbers written by barriers are greater than all previous numbers*/ verify(data); - toBeRestored(AZ_LOG_INFO, __FILE__, FUNC_NAME, __LINE__, 0, "Info: took %f ms, non_barrier_grants=%" PRId32 ", non_barrier_refusals=%" PRId64 " barrier_grants=%" PRId32 ", barrier_refusals=%" PRId64 "\n", timer_global_get_elapsed_ms() - data->startTimems, + LOGGER_LOG_WITH_CONFIG(old_config, LOG_LEVEL_INFO, NULL, "Info: took %f ms, non_barrier_grants=%" PRId32 ", non_barrier_refusals=%" PRId64 " barrier_grants=%" PRId32 ", barrier_refusals=%" PRId64 "\n", timer_global_get_elapsed_ms() - data->startTimems, interlocked_add(&non_barrier_grants, 0), interlocked_add_64(&non_barrier_refusals, 0), interlocked_add(&barrier_grants, 0), @@ -1168,7 +1169,7 @@ TEST_FUNCTION(sm_does_not_block) sm_destroy(data->sm); free(data); - xlogging_set_log_function(toBeRestored); + logger_set_config(old_config); } /*below tests aim to see that calling any API produces GRANT/REFUSED from any state*/ diff --git a/common/tests/thandle_ut/thandle_flex_user.c b/common/tests/thandle_ut/thandle_flex_user.c index 476a3b0..4137b47 100644 --- a/common/tests/thandle_ut/thandle_flex_user.c +++ b/common/tests/thandle_ut/thandle_flex_user.c @@ -4,7 +4,7 @@ #include // for strlen, memcpy #include -#include "c_logging/xlogging.h" // for LogError +#include "c_logging/logger.h" // for LogError #include "macro_utils/macro_utils.h" diff --git a/common/tests/thandle_ut/thandle_user.c b/common/tests/thandle_ut/thandle_user.c index b505bc0..c8d7dc4 100644 --- a/common/tests/thandle_ut/thandle_user.c +++ b/common/tests/thandle_ut/thandle_user.c @@ -5,7 +5,7 @@ #include #include // for strlen, memcpy -#include "c_logging/xlogging.h" // for LogError +#include "c_logging/logger.h" // for LogError #include "macro_utils/macro_utils.h" diff --git a/common/tests/thandle_ut/thandle_user_33_characters.c b/common/tests/thandle_ut/thandle_user_33_characters.c index 4a7f608..6e1fea2 100644 --- a/common/tests/thandle_ut/thandle_user_33_characters.c +++ b/common/tests/thandle_ut/thandle_user_33_characters.c @@ -8,7 +8,7 @@ #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep -#include "c_logging/xlogging.h" // for LogError +#include "c_logging/logger.h" // for LogError #include "c_pal/thandle.h" diff --git a/deps/c-logging b/deps/c-logging index c8a5f23..b1b3114 160000 --- a/deps/c-logging +++ b/deps/c-logging @@ -1 +1 @@ -Subproject commit c8a5f2314d83af238b8359c5b70c61f5e94f0aa1 +Subproject commit b1b3114d9e3cb2e7699bbfc4d1956019f45fe50d diff --git a/deps/c-testrunnerswitcher b/deps/c-testrunnerswitcher index 71986d9..ca5faa3 160000 --- a/deps/c-testrunnerswitcher +++ b/deps/c-testrunnerswitcher @@ -1 +1 @@ -Subproject commit 71986d97278b0f86ebd16d94882b4fcb4867cbe1 +Subproject commit ca5faa35c32208c748cdde92ed06deae70494675 diff --git a/deps/ctest b/deps/ctest index b869835..cbc3398 160000 --- a/deps/ctest +++ b/deps/ctest @@ -1 +1 @@ -Subproject commit b86983596d1be8d842b12687ddda147b86c908fd +Subproject commit cbc3398b77a3959295063e3d30a94cc1595435fd diff --git a/deps/macro-utils-c b/deps/macro-utils-c index c736888..f8616ff 160000 --- a/deps/macro-utils-c +++ b/deps/macro-utils-c @@ -1 +1 @@ -Subproject commit c736888008fed2e50ecf4f1d1451ca4d1d37226a +Subproject commit f8616ff97291003c5e428b59dfcb046c2a62f676 diff --git a/deps/mimalloc b/deps/mimalloc index 5ac9e36..4e50d67 160000 --- a/deps/mimalloc +++ b/deps/mimalloc @@ -1 +1 @@ -Subproject commit 5ac9e36ed6ed8e5d33f95f733c3a7fbeb9211a7c +Subproject commit 4e50d6714d471b72b2285e25a3df6c92db944593 diff --git a/deps/umock-c b/deps/umock-c index d19d707..e11f1c4 160000 --- a/deps/umock-c +++ b/deps/umock-c @@ -1 +1 @@ -Subproject commit d19d70719316b990fee15fa3bf198027250bcae0 +Subproject commit e11f1c408abc9c7345f1e9390486d60fec16c719 diff --git a/interfaces/reals/CMakeLists.txt b/interfaces/reals/CMakeLists.txt index 61b8d68..c54fec2 100644 --- a/interfaces/reals/CMakeLists.txt +++ b/interfaces/reals/CMakeLists.txt @@ -26,4 +26,4 @@ endif() add_library(pal_interfaces_reals INTERFACE) target_include_directories(pal_interfaces_reals INTERFACE ${CMAKE_CURRENT_LIST_DIR}) -target_link_libraries(pal_interfaces_reals INTERFACE c_logging) +target_link_libraries(pal_interfaces_reals INTERFACE c_logging_v2) diff --git a/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c b/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c index 59b5122..504f298 100644 --- a/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c +++ b/interfaces/tests/gballoc_hl_perf/gballoc_hl_perf.c @@ -3,7 +3,7 @@ #include #include -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "testrunnerswitcher.h" #include "c_pal/timer.h" diff --git a/interfaces/tests/uuid_int/uuid_int.c b/interfaces/tests/uuid_int/uuid_int.c index b3b8a70..fd58d96 100644 --- a/interfaces/tests/uuid_int/uuid_int.c +++ b/interfaces/tests/uuid_int/uuid_int.c @@ -6,7 +6,7 @@ #include "macro_utils/macro_utils.h" // IWYU pragma: keep #include "testrunnerswitcher.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/uuid.h" diff --git a/linux/src/async_socket_linux.c b/linux/src/async_socket_linux.c index 95862be..fde59ea 100644 --- a/linux/src/async_socket_linux.c +++ b/linux/src/async_socket_linux.c @@ -11,7 +11,9 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/log_context.h" +#include "c_logging/log_context_property_type_ascii_char_ptr.h" +#include "c_logging/logger.h" #include "c_pal/completion_port_linux.h" #include "c_pal/execution_engine.h" diff --git a/linux/src/completion_port_linux.c b/linux/src/completion_port_linux.c index fbb6d5d..2fd04af 100644 --- a/linux/src/completion_port_linux.c +++ b/linux/src/completion_port_linux.c @@ -14,7 +14,9 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/log_context.h" +#include "c_logging/log_context_property_type_ascii_char_ptr.h" +#include "c_logging/logger.h" #include "c_pal/containing_record.h" #include "c_pal/interlocked.h" diff --git a/linux/src/execution_engine_linux.c b/linux/src/execution_engine_linux.c index 5811958..3a05da4 100644 --- a/linux/src/execution_engine_linux.c +++ b/linux/src/execution_engine_linux.c @@ -5,7 +5,7 @@ #include "macro_utils/macro_utils.h" // IWYU pragma: keep -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/execution_engine_linux.h" #include "c_pal/refcount.h" diff --git a/linux/src/gballoc_hl_passthrough.c b/linux/src/gballoc_hl_passthrough.c index 8111f32..ac8051b 100644 --- a/linux/src/gballoc_hl_passthrough.c +++ b/linux/src/gballoc_hl_passthrough.c @@ -5,7 +5,7 @@ #include // for memset #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_ll.h" diff --git a/linux/src/gballoc_ll_passthrough.c b/linux/src/gballoc_ll_passthrough.c index a56fc66..addab72 100644 --- a/linux/src/gballoc_ll_passthrough.c +++ b/linux/src/gballoc_ll_passthrough.c @@ -6,7 +6,9 @@ #include #include -#include "c_logging/xlogging.h" +#include "macro_utils/macro_utils.h" + +#include "c_logging/logger.h" #include "c_pal/gballoc_ll.h" diff --git a/linux/src/pipe_linux.c b/linux/src/pipe_linux.c index f68076b..e31cb32 100644 --- a/linux/src/pipe_linux.c +++ b/linux/src/pipe_linux.c @@ -6,7 +6,7 @@ #include "umock_c/umock_c_prod.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/pipe.h" diff --git a/linux/src/platform_linux.c b/linux/src/platform_linux.c index 3b31ecd..e4c27c6 100644 --- a/linux/src/platform_linux.c +++ b/linux/src/platform_linux.c @@ -4,7 +4,7 @@ #include // for NULL #include "macro_utils/macro_utils.h" // for MU_FAILURE -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/completion_port_linux.h" #include "c_pal/platform.h" diff --git a/linux/src/srw_lock_linux.c b/linux/src/srw_lock_linux.c index 3c18a2e..554d8ba 100644 --- a/linux/src/srw_lock_linux.c +++ b/linux/src/srw_lock_linux.c @@ -7,7 +7,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep diff --git a/linux/src/string_utils.c b/linux/src/string_utils.c index a873b9b..64fb863 100644 --- a/linux/src/string_utils.c +++ b/linux/src/string_utils.c @@ -10,7 +10,7 @@ #include "macro_utils/macro_utils.h" // IWYU pragma: keep #include "umock_c/umock_c_prod.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" // IWYU pragma: keep diff --git a/linux/src/sysinfo_linux.c b/linux/src/sysinfo_linux.c index 384e01f..4d1d6b5 100644 --- a/linux/src/sysinfo_linux.c +++ b/linux/src/sysinfo_linux.c @@ -3,7 +3,9 @@ #include #include -#include "c_logging/xlogging.h" +#include "macro_utils/macro_utils.h" + +#include "c_logging/logger.h" #include "c_pal/sysinfo.h" uint32_t sysinfo_get_processor_count(void) diff --git a/linux/src/threadpool_linux.c b/linux/src/threadpool_linux.c index 3a89d53..be62abe 100644 --- a/linux/src/threadpool_linux.c +++ b/linux/src/threadpool_linux.c @@ -17,7 +17,9 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/log_context.h" +#include "c_logging/log_context_property_type_ascii_char_ptr.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" // IWYU pragma: keep #include "c_pal/gballoc_hl_redirect.h" diff --git a/linux/src/timer_linux.c b/linux/src/timer_linux.c index e69bf9c..8ffcf5d 100644 --- a/linux/src/timer_linux.c +++ b/linux/src/timer_linux.c @@ -5,7 +5,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_ll.h" // IWYU pragma: keep #include "c_pal/gballoc_ll_redirect.h" // IWYU pragma: keep diff --git a/linux/src/uuid_linux.c b/linux/src/uuid_linux.c index 2389381..92f5e18 100644 --- a/linux/src/uuid_linux.c +++ b/linux/src/uuid_linux.c @@ -7,7 +7,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/uuid.h" diff --git a/linux/tests/threadpool_linux_int/threadpool_linux_int.c b/linux/tests/threadpool_linux_int/threadpool_linux_int.c index 17f2105..0c42018 100644 --- a/linux/tests/threadpool_linux_int/threadpool_linux_int.c +++ b/linux/tests/threadpool_linux_int/threadpool_linux_int.c @@ -6,7 +6,7 @@ #include #include -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "macro_utils/macro_utils.h" // IWYU pragma: keep @@ -25,6 +25,8 @@ #include "c_pal/thandle.h" // IWYU pragma: keep #include "c_pal/thandle_ll.h" +static volatile_atomic int32_t g_call_count; + typedef struct WAIT_WORK_CONTEXT_TAG { volatile_atomic int32_t call_count; @@ -49,6 +51,7 @@ TEST_SUITE_CLEANUP(suite_cleanup) TEST_FUNCTION_INITIALIZE(method_init) { + (void)interlocked_exchange(&g_call_count, 0); } TEST_FUNCTION_CLEANUP(method_cleanup) @@ -85,9 +88,8 @@ static void threadpool_task_wait_random(void* parameter) static void work_function(void* context) { - volatile_atomic int32_t* call_count = (volatile_atomic int32_t*)context; - (void)interlocked_increment(call_count); - wake_by_address_single(call_count); + (void)interlocked_increment(&g_call_count); + wake_by_address_single(&g_call_count); } static void wait_work_function(void* context) @@ -258,7 +260,6 @@ TEST_FUNCTION(one_start_timer_works_runs_once) { // assert // create an execution engine - volatile_atomic int32_t call_count; EXECUTION_ENGINE_PARAMETERS_LINUX params; params.min_thread_count = 1; params.max_thread_count = 16; @@ -277,19 +278,17 @@ TEST_FUNCTION(one_start_timer_works_runs_once) bool need_to_retry = true; do { - (void)interlocked_exchange(&call_count, 0); - LogInfo("Starting timer"); // act (start a timer to start delayed and then execute once) TIMER_INSTANCE_HANDLE timer; - ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 2000, 0, work_function, (void*)&call_count, &timer)); + ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 2000, 0, work_function, NULL, &timer)); // assert // Timer starts after 2 seconds, wait a bit and it should not yet have run ThreadAPI_Sleep(500); - if (interlocked_add(&call_count, 0) != 0) + if (interlocked_add(&g_call_count, 0) != 0) { LogWarning("Timer ran after sleeping 500ms, we just got unlucky, try test again"); } @@ -298,12 +297,12 @@ TEST_FUNCTION(one_start_timer_works_runs_once) LogInfo("Waiting for timer to execute after short delay of no execution"); // Should eventually run once (wait up to 2.5 seconds, but it should run in 1.5 seconds) - wait_for_equal(&call_count, 1, 5000); + wait_for_equal(&g_call_count, 1, 5000); LogInfo("Timer completed, make sure it doesn't run again"); // And should not run again ThreadAPI_Sleep(5000); - ASSERT_ARE_EQUAL(uint32_t, 1, interlocked_add(&call_count, 0)); + ASSERT_ARE_EQUAL(uint32_t, 1, interlocked_add(&g_call_count, 0)); LogInfo("Done waiting for timer"); need_to_retry = false; @@ -321,7 +320,6 @@ TEST_FUNCTION(restart_timer_works_runs_once) { // assert // create an execution engine - volatile_atomic int32_t call_count; EXECUTION_ENGINE_HANDLE execution_engine = execution_engine_create(NULL); ASSERT_IS_NOT_NULL(execution_engine); @@ -336,13 +334,11 @@ TEST_FUNCTION(restart_timer_works_runs_once) bool need_to_retry = true; do { - (void)interlocked_exchange(&call_count, 0); - LogInfo("Starting timer"); // start a timer to start delayed after 4 seconds (which would fail test) TIMER_INSTANCE_HANDLE timer; - ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 4000, 0, work_function, (void*)&call_count, &timer)); + ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 4000, 0, work_function, (void*)&g_call_count, &timer)); // act (restart timer to start delayed instead after 2 seconds) ASSERT_ARE_EQUAL(int, 0, threadpool_timer_restart(timer, 2000, 0)); @@ -351,7 +347,7 @@ TEST_FUNCTION(restart_timer_works_runs_once) // Timer starts after 2 seconds, wait a bit and it should not yet have run ThreadAPI_Sleep(500); - if (interlocked_add(&call_count, 0) != 0) + if (interlocked_add(&g_call_count, 0) != 0) { LogWarning("Timer ran after sleeping 500ms, we just got unlucky, try test again"); } @@ -360,12 +356,12 @@ TEST_FUNCTION(restart_timer_works_runs_once) LogInfo("Waiting for timer to execute after short delay of no execution"); // Should eventually run once (wait up to 2.5 seconds, but it should run in 1.5 seconds) - wait_for_equal(&call_count, 1, 2000); + wait_for_equal(&g_call_count, 1, 2000); LogInfo("Timer completed, make sure it doesn't run again"); // And should not run again ThreadAPI_Sleep(5000); - ASSERT_ARE_EQUAL(uint32_t, 1, interlocked_add(&call_count, 0)); + ASSERT_ARE_EQUAL(uint32_t, 1, interlocked_add(&g_call_count, 0)); LogInfo("Done waiting for timer"); need_to_retry = false; @@ -383,7 +379,6 @@ TEST_FUNCTION(one_start_timer_works_runs_periodically) { // assert // create an execution engine - volatile_atomic int32_t call_count; EXECUTION_ENGINE_HANDLE execution_engine = execution_engine_create(NULL); ASSERT_IS_NOT_NULL(execution_engine); @@ -391,17 +386,15 @@ TEST_FUNCTION(one_start_timer_works_runs_periodically) THANDLE(THREADPOOL) threadpool = threadpool_create(execution_engine); ASSERT_IS_NOT_NULL(threadpool); - (void)interlocked_exchange(&call_count, 0); - // act (start a timer to start delayed and then execute every 500ms) LogInfo("Starting timer"); TIMER_INSTANCE_HANDLE timer; - ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 100, 500, work_function, (void*)&call_count, &timer)); + ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 100, 500, work_function, (void*)&g_call_count, &timer)); // assert // Timer should run 4 times in about 2.1 seconds - wait_for_equal(&call_count, 4, 3000); + wait_for_equal(&g_call_count, 4, 3000); LogInfo("Timer completed 4 times"); // cleanup @@ -414,7 +407,6 @@ TEST_FUNCTION(timer_cancel_restart_works_runs_periodically) { // assert // create an execution engine - volatile_atomic int32_t call_count; EXECUTION_ENGINE_HANDLE execution_engine = execution_engine_create(NULL); ASSERT_IS_NOT_NULL(execution_engine); @@ -422,27 +414,25 @@ TEST_FUNCTION(timer_cancel_restart_works_runs_periodically) THANDLE(THREADPOOL) threadpool = threadpool_create(execution_engine); ASSERT_IS_NOT_NULL(threadpool); - (void)interlocked_exchange(&call_count, 0); - // start a timer to start delayed and then execute every 500ms LogInfo("Starting timer"); TIMER_INSTANCE_HANDLE timer; - ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 100, 500, work_function, (void*)&call_count, &timer)); + ASSERT_ARE_EQUAL(int, 0, threadpool_timer_start(threadpool, 100, 500, work_function, (void*)&g_call_count, &timer)); // Timer should run 4 times in about 2.1 seconds - wait_for_equal(&call_count, 4, 3000); + wait_for_equal(&g_call_count, 4, 3000); LogInfo("Timer completed 4 times"); // act LogInfo("Cancel then restart timer"); threadpool_timer_cancel(timer); - (void)interlocked_exchange(&call_count, 0); + (void)interlocked_exchange(&g_call_count, 0); ASSERT_ARE_EQUAL(int, 0, threadpool_timer_restart(timer, 100, 1000)); // assert // Timer should run 2 more times in about 2.1 seconds - wait_for_equal(&call_count, 2, 3000); + wait_for_equal(&g_call_count, 2, 3000); LogInfo("Timer completed 2 more times"); // cleanup @@ -456,7 +446,6 @@ TEST_FUNCTION(stop_timer_waits_for_ongoing_execution) // assert // create an execution engine WAIT_WORK_CONTEXT wait_work_context; - volatile_atomic int32_t call_count; EXECUTION_ENGINE_HANDLE execution_engine = execution_engine_create(NULL); ASSERT_IS_NOT_NULL(execution_engine); @@ -494,7 +483,6 @@ TEST_FUNCTION(cancel_timer_waits_for_ongoing_execution) // assert // create an execution engine WAIT_WORK_CONTEXT wait_work_context; - volatile_atomic int32_t call_count; EXECUTION_ENGINE_HANDLE execution_engine = execution_engine_create(NULL); ASSERT_IS_NOT_NULL(execution_engine); diff --git a/win32/CMakeLists.txt b/win32/CMakeLists.txt index e850b1c..d899b5a 100644 --- a/win32/CMakeLists.txt +++ b/win32/CMakeLists.txt @@ -63,7 +63,7 @@ include_directories(../c_pal_ll/interfaces/inc) add_library(pal_win32 ${pal_win32_h_files} ${pal_win32_c_files} ${pal_win32_md_files} ${pal_common_md_files}) -target_link_libraries(pal_win32 pal_interfaces ws2_32 synchronization rpcrt4 c_logging) +target_link_libraries(pal_win32 pal_interfaces ws2_32 synchronization rpcrt4 c_logging_v2) if(${GBALLOC_LL_TYPE} STREQUAL "MIMALLOC") target_link_libraries(pal_win32 mimalloc-obj) endif() diff --git a/win32/devdoc/gballoc_ll_jemalloc.md b/win32/devdoc/gballoc_ll_jemalloc.md index 5a2c770..ee4ea0f 100644 --- a/win32/devdoc/gballoc_ll_jemalloc.md +++ b/win32/devdoc/gballoc_ll_jemalloc.md @@ -165,4 +165,4 @@ static void jemalloc_print_stats_callback(void* context, const char* text) **SRS_GBALLOC_LL_JEMALLOC_01_009: [** If `text` is NULL, `jemalloc_print_stats_callback` shall return. **]** -**SRS_GBALLOC_LL_JEMALLOC_01_010: [** Otherwise, `jemalloc_print_stats_callback` shall print (log) `text`, breaking it does in chunks of `LOG_SIZE_REGULAR / 2`. **]** \ No newline at end of file +**SRS_GBALLOC_LL_JEMALLOC_01_010: [** Otherwise, `jemalloc_print_stats_callback` shall print (log) `text`, breaking it does in chunks of `LOG_MAX_MESSAGE_LENGTH / 2`. **]** \ No newline at end of file diff --git a/win32/src/async_socket_win32.c b/win32/src/async_socket_win32.c index 89ec6c3..79dad4f 100644 --- a/win32/src/async_socket_win32.c +++ b/win32/src/async_socket_win32.c @@ -9,7 +9,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" diff --git a/win32/src/execution_engine_win32.c b/win32/src/execution_engine_win32.c index 797d4df..7a9756a 100644 --- a/win32/src/execution_engine_win32.c +++ b/win32/src/execution_engine_win32.c @@ -4,7 +4,7 @@ #include "windows.h" #include "macro_utils/macro_utils.h" #include "c_pal/refcount.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/execution_engine.h" #include "c_pal/execution_engine_win32.h" diff --git a/win32/src/file_win32.c b/win32/src/file_win32.c index dd8a87f..66d61d1 100644 --- a/win32/src/file_win32.c +++ b/win32/src/file_win32.c @@ -7,7 +7,7 @@ #include "windows.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/execution_engine_win32.h" #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" diff --git a/win32/src/gballoc_hl_metrics.c b/win32/src/gballoc_hl_metrics.c index fa7c3cf..4c0900d 100644 --- a/win32/src/gballoc_hl_metrics.c +++ b/win32/src/gballoc_hl_metrics.c @@ -5,7 +5,7 @@ #include #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/timer.h" #include "c_pal/gballoc_ll.h" diff --git a/win32/src/gballoc_hl_passthrough.c b/win32/src/gballoc_hl_passthrough.c index f651835..8c63879 100644 --- a/win32/src/gballoc_hl_passthrough.c +++ b/win32/src/gballoc_hl_passthrough.c @@ -4,7 +4,7 @@ #include #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/lazy_init.h" #include "c_pal/gballoc_ll.h" diff --git a/win32/src/gballoc_ll_jemalloc.c b/win32/src/gballoc_ll_jemalloc.c index 1afed6c..51f548b 100644 --- a/win32/src/gballoc_ll_jemalloc.c +++ b/win32/src/gballoc_ll_jemalloc.c @@ -4,7 +4,7 @@ #include #include -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_ll.h" #include "jemalloc/jemalloc.h" @@ -192,15 +192,15 @@ static void jemalloc_print_stats_callback(void* context, const char* text) } else { - /* Codes_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_SIZE_REGULAR / 2. ]*/ + /* Codes_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_MAX_MESSAGE_LENGTH / 2. ]*/ size_t text_length = strlen(text); size_t pos = 0; while (pos < text_length) { size_t chars_to_print = text_length - pos; - if (chars_to_print > LOG_SIZE_REGULAR / 2) + if (chars_to_print > LOG_MAX_MESSAGE_LENGTH / 2) { - chars_to_print = LOG_SIZE_REGULAR / 2; + chars_to_print = LOG_MAX_MESSAGE_LENGTH / 2; } LogInfo("%.*s", (int)chars_to_print, text + pos); diff --git a/win32/src/gballoc_ll_mimalloc.c b/win32/src/gballoc_ll_mimalloc.c index b1b2c14..dcc8b69 100644 --- a/win32/src/gballoc_ll_mimalloc.c +++ b/win32/src/gballoc_ll_mimalloc.c @@ -7,7 +7,7 @@ #include "mimalloc.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_ll.h" diff --git a/win32/src/gballoc_ll_passthrough.c b/win32/src/gballoc_ll_passthrough.c index 9e00644..76bac93 100644 --- a/win32/src/gballoc_ll_passthrough.c +++ b/win32/src/gballoc_ll_passthrough.c @@ -5,7 +5,7 @@ #include #include -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_ll.h" diff --git a/win32/src/gballoc_ll_win32heap.c b/win32/src/gballoc_ll_win32heap.c index 11e8b2a..becdf29 100644 --- a/win32/src/gballoc_ll_win32heap.c +++ b/win32/src/gballoc_ll_win32heap.c @@ -5,7 +5,7 @@ #include "windows.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/lazy_init.h" diff --git a/win32/src/pipe_win32.c b/win32/src/pipe_win32.c index c2e9d91..850b88d 100644 --- a/win32/src/pipe_win32.c +++ b/win32/src/pipe_win32.c @@ -8,7 +8,7 @@ // Tell IWYU to keep macro_utils.h because we have MU_FAILURE (even though we say that can come from umock_c_prod.h) #include "macro_utils/macro_utils.h" // IWYU pragma: keep #include "umock_c/umock_c_prod.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/pipe.h" IMPLEMENT_MOCKABLE_FUNCTION(, FILE*, pipe_popen, const char*, command) diff --git a/win32/src/platform_win32.c b/win32/src/platform_win32.c index 536bf10..5042b1b 100644 --- a/win32/src/platform_win32.c +++ b/win32/src/platform_win32.c @@ -1,13 +1,16 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#include "macro_utils/macro_utils.h" -#include "c_pal/platform.h" -#include "c_logging/xlogging.h" #include "winsock2.h" #include "minwindef.h" #include "winnt.h" +#include "macro_utils/macro_utils.h" + +#include "c_pal/platform.h" + +#include "c_logging/logger.h" + int platform_init(void) { int result; diff --git a/win32/src/srw_lock_ll_win32.c b/win32/src/srw_lock_ll_win32.c index 0f52946..f22577b 100644 --- a/win32/src/srw_lock_ll_win32.c +++ b/win32/src/srw_lock_ll_win32.c @@ -2,7 +2,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/srw_lock_ll.h" diff --git a/win32/src/srw_lock_win32.c b/win32/src/srw_lock_win32.c index caf62ca..eb1558d 100644 --- a/win32/src/srw_lock_win32.c +++ b/win32/src/srw_lock_win32.c @@ -5,7 +5,7 @@ #include "windows.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" diff --git a/win32/src/string_utils.c b/win32/src/string_utils.c index b780c6e..7eea7a1 100644 --- a/win32/src/string_utils.c +++ b/win32/src/string_utils.c @@ -13,7 +13,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_hl.h" #include "c_pal/gballoc_hl_redirect.h" diff --git a/win32/src/sysinfo_win32.c b/win32/src/sysinfo_win32.c index fc159c1..7d882ef 100644 --- a/win32/src/sysinfo_win32.c +++ b/win32/src/sysinfo_win32.c @@ -3,7 +3,7 @@ #include #include "windows.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/sysinfo.h" diff --git a/win32/src/threadpool_win32.c b/win32/src/threadpool_win32.c index e44414a..687e5f3 100644 --- a/win32/src/threadpool_win32.c +++ b/win32/src/threadpool_win32.c @@ -5,7 +5,7 @@ #include "windows.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/execution_engine.h" #include "c_pal/execution_engine_win32.h" diff --git a/win32/src/timer_win32.c b/win32/src/timer_win32.c index 11c8a8c..2c1ed69 100644 --- a/win32/src/timer_win32.c +++ b/win32/src/timer_win32.c @@ -2,7 +2,7 @@ #include "windows.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/gballoc_ll.h" #include "c_pal/gballoc_ll_redirect.h" diff --git a/win32/src/uuid_win32.c b/win32/src/uuid_win32.c index d6ff1ec..0b90270 100644 --- a/win32/src/uuid_win32.c +++ b/win32/src/uuid_win32.c @@ -5,7 +5,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/uuid.h" diff --git a/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c b/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c index 6d56b79..2f6d14b 100644 --- a/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c +++ b/win32/tests/gballoc_ll_jemalloc_ut/gballoc_ll_jemalloc_ut.c @@ -554,7 +554,7 @@ TEST_FUNCTION(gballoc_ll_print_stats_does_not_call_the_print_function) } /* Tests_SRS_GBALLOC_LL_JEMALLOC_01_008: [ gballoc_ll_print_stats shall call je_malloc_stats_print and pass to it jemalloc_print_stats_callback as print callback. ]*/ -/* Tests_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_SIZE_REGULAR / 2. ]*/ +/* Tests_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_MAX_MESSAGE_LENGTH / 2. ]*/ TEST_FUNCTION(gballoc_ll_print_stats_calls_the_print_function_and_prints_1_small_text_line) { ///arrange @@ -570,7 +570,7 @@ TEST_FUNCTION(gballoc_ll_print_stats_calls_the_print_function_and_prints_1_small } /* Tests_SRS_GBALLOC_LL_JEMALLOC_01_008: [ gballoc_ll_print_stats shall call je_malloc_stats_print and pass to it jemalloc_print_stats_callback as print callback. ]*/ -/* Tests_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_SIZE_REGULAR / 2. ]*/ +/* Tests_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_MAX_MESSAGE_LENGTH / 2. ]*/ TEST_FUNCTION(gballoc_ll_print_stats_calls_the_print_function_and_prints_multiple_small_text_lines) { ///arrange @@ -588,7 +588,7 @@ TEST_FUNCTION(gballoc_ll_print_stats_calls_the_print_function_and_prints_multipl } /* Tests_SRS_GBALLOC_LL_JEMALLOC_01_008: [ gballoc_ll_print_stats shall call je_malloc_stats_print and pass to it jemalloc_print_stats_callback as print callback. ]*/ -/* Tests_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_SIZE_REGULAR / 2. ]*/ +/* Tests_SRS_GBALLOC_LL_JEMALLOC_01_010: [ Otherwise, jemalloc_print_stats_callback shall print (log) text, breaking it does in chunks of LOG_MAX_MESSAGE_LENGTH / 2. ]*/ TEST_FUNCTION(gballoc_ll_print_stats_calls_the_print_function_and_prints_one_huge_line) { ///arrange diff --git a/win32/tests/threadpool_win32_int/threadpool_win32_int.c b/win32/tests/threadpool_win32_int/threadpool_win32_int.c index 9edb215..b2f8f95 100644 --- a/win32/tests/threadpool_win32_int/threadpool_win32_int.c +++ b/win32/tests/threadpool_win32_int/threadpool_win32_int.c @@ -10,7 +10,7 @@ #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "c_pal/timer.h" #include "c_pal/threadpool.h" @@ -130,7 +130,7 @@ TEST_SUITE_INITIALIZE(suite_init) // Turn off logging so it doesn't put unneccesary // sleeps in the code. - xlogging_set_log_function(NULL); + logger_set_config((LOGGER_CONFIG) { .log_sinks = NULL, .log_sink_count = 0 }); } TEST_SUITE_CLEANUP(suite_cleanup) diff --git a/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c b/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c index 6032c8b..d990e59 100644 --- a/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c +++ b/win32/tests/threadpool_win32_ut/threadpool_win32_ut.c @@ -7,7 +7,7 @@ #include "ws2tcpip.h" #include "windows.h" #include "macro_utils/macro_utils.h" -#include "c_logging/xlogging.h" +#include "c_logging/logger.h" #include "real_gballoc_ll.h"