From 2d21c41eab3c2af07a981061a1b66200ab627c62 Mon Sep 17 00:00:00 2001 From: torsten-pf Date: Wed, 31 Jul 2024 10:14:28 +0200 Subject: [PATCH] Added traces logging on Windows --- include/hsmcpp/logging.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/hsmcpp/logging.hpp b/include/hsmcpp/logging.hpp index d3dc468..e34771e 100644 --- a/include/hsmcpp/logging.hpp +++ b/include/hsmcpp/logging.hpp @@ -28,6 +28,9 @@ #ifndef HSM_DISABLE_TRACES #ifdef PLATFORM_ARDUINO #include + #elif defined(PLATFORM_WINDOWS) + #define WINDOWS_LEAN_AND_MEAN + #include #elif !defined(PLATFORM_FREERTOS) #include #include @@ -45,6 +48,9 @@ #ifdef PLATFORM_ARDUINO #define HSM_TRACE_CALL_COMMON() #define HSM_TRACE_INIT() + #elif defined(PLATFORM_WINDOWS) + #define HSM_TRACE_CALL_COMMON() const int _tid = GetCurrentThreadId(); (void)_tid + #define HSM_TRACE_INIT() if (0 == g_hsm_traces_pid){ g_hsm_traces_pid = (int) GetCurrentProcessId(); } #elif !defined(PLATFORM_FREERTOS) #define HSM_TRACE_CALL_COMMON() const int _tid = syscall(__NR_gettid); (void)_tid #define HSM_TRACE_INIT() if (0 == g_hsm_traces_pid){ g_hsm_traces_pid = getpid(); }