From f040b3c32f6c5efe99abb635ae603c38b9af9e99 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 10 Jun 2025 11:21:49 +0200 Subject: [PATCH 1/6] Improving Logging by using Arduino_DebugUtils pull #48 --- src/AIoTC_Config.h | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index a25b8108..2b67cd64 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -34,25 +34,22 @@ #define NTP_USE_RANDOM_PORT (1) #endif -#ifndef DEBUG_ERROR - #define DEBUG_ERROR(fmt, ...) Debug.print(DBG_ERROR, fmt, ## __VA_ARGS__) -#endif - -#ifndef DEBUG_WARNING - #define DEBUG_WARNING(fmt, ...) Debug.print(DBG_WARNING, fmt, ## __VA_ARGS__) -#endif - -#ifndef DEBUG_INFO - #define DEBUG_INFO(fmt, ...) Debug.print(DBG_INFO, fmt, ## __VA_ARGS__) -#endif - -#ifndef DEBUG_DEBUG - #define DEBUG_DEBUG(fmt, ...) Debug.print(DBG_DEBUG, fmt, ## __VA_ARGS__) +#if defined __has_include + #if !__has_include () + #define DEBUG_ERROR (void) 0 + #define DEBUG_WARNING (void) 0 + #define DEBUG_INFO (void) 0 + #define DEBUG_DEBUG (void) 0 + #define DEBUG_VERBOSE (void) 0 + #endif #endif -#ifndef DEBUG_VERBOSE - #define DEBUG_VERBOSE(fmt, ...) //Debug.print(DBG_VERBOSE, fmt, ## __VA_ARGS__) -#endif +// include directives must be ordered in such a way that this always comes first, +// otherwise the log level will be incorrectly set +#ifndef DEBUG_LEVEL + #define DEBUG_LEVEL DEBUG_LEVEL_INFO +#endif // DEBUG_LEVEL +// #include /****************************************************************************** * AUTOMATICALLY CONFIGURED DEFINES From 1e4743bc17bb718ad7269c4566354d3b3bbabbad Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 10 Jun 2025 12:50:35 +0200 Subject: [PATCH 2/6] [TMP] calculate correct size deltas --- .github/workflows/compile-examples.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index d30277a0..362b1609 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -24,6 +24,8 @@ jobs: - name: Arduino_ConnectionHandler - name: ArduinoHttpClient - name: Arduino_DebugUtils + - source-url: https://github.com/arduino-libraries/Arduino_DebugUtils.git + version: logging-improvements - name: ArduinoMqttClient - name: Arduino_SecureElement - name: Arduino_CloudUtils From dba6ca89df841136636397e177ac69405e7c78dc Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 10 Jun 2025 14:02:04 +0200 Subject: [PATCH 3/6] fixup! Improving Logging by using Arduino_DebugUtils pull #48 --- src/AIoTC_Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index 2b67cd64..87bd994e 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -49,7 +49,7 @@ #ifndef DEBUG_LEVEL #define DEBUG_LEVEL DEBUG_LEVEL_INFO #endif // DEBUG_LEVEL -// #include +#include /****************************************************************************** * AUTOMATICALLY CONFIGURED DEFINES From 2cac6a7c8ea1dfdcd34cc036809a3f36a1d82f20 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 10 Jun 2025 14:08:05 +0200 Subject: [PATCH 4/6] fixup! Improving Logging by using Arduino_DebugUtils pull #48 --- src/AIoTC_Config.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index 87bd994e..94ff13ec 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -34,6 +34,12 @@ #define NTP_USE_RANDOM_PORT (1) #endif +// include directives must be ordered in such a way that this always comes first, +// otherwise the log level will be incorrectly set +#ifndef DEBUG_LEVEL + #define DEBUG_LEVEL DEBUG_LEVEL_INFO +#endif // DEBUG_LEVEL + #if defined __has_include #if !__has_include () #define DEBUG_ERROR (void) 0 @@ -41,15 +47,13 @@ #define DEBUG_INFO (void) 0 #define DEBUG_DEBUG (void) 0 #define DEBUG_VERBOSE (void) 0 + #else + #include #endif #endif -// include directives must be ordered in such a way that this always comes first, -// otherwise the log level will be incorrectly set -#ifndef DEBUG_LEVEL - #define DEBUG_LEVEL DEBUG_LEVEL_INFO -#endif // DEBUG_LEVEL -#include + + /****************************************************************************** * AUTOMATICALLY CONFIGURED DEFINES From 38ef1107219bcab46f2a2367a94c6b20819d143d Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 10 Jun 2025 14:19:24 +0200 Subject: [PATCH 5/6] fixup! Improving Logging by using Arduino_DebugUtils pull #48 --- src/AIoTC_Config.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index 94ff13ec..be9cef0f 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -47,14 +47,11 @@ #define DEBUG_INFO (void) 0 #define DEBUG_DEBUG (void) 0 #define DEBUG_VERBOSE (void) 0 - #else + #else if defined(__cplusplus) #include #endif #endif - - - /****************************************************************************** * AUTOMATICALLY CONFIGURED DEFINES ******************************************************************************/ From 70d4619a1247c3eeab76313aa1a6f1aed0e165a7 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 10 Jun 2025 14:21:02 +0200 Subject: [PATCH 6/6] fixup! Improving Logging by using Arduino_DebugUtils pull #48 --- src/AIoTC_Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index be9cef0f..5a2a63fc 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -47,7 +47,7 @@ #define DEBUG_INFO (void) 0 #define DEBUG_DEBUG (void) 0 #define DEBUG_VERBOSE (void) 0 - #else if defined(__cplusplus) + #elif defined(__cplusplus) #include #endif #endif