Skip to content

Commit f040b3c

Browse files
Improving Logging by using Arduino_DebugUtils pull #48
1 parent e649174 commit f040b3c

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/AIoTC_Config.h

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,22 @@
3434
#define NTP_USE_RANDOM_PORT (1)
3535
#endif
3636

37-
#ifndef DEBUG_ERROR
38-
#define DEBUG_ERROR(fmt, ...) Debug.print(DBG_ERROR, fmt, ## __VA_ARGS__)
39-
#endif
40-
41-
#ifndef DEBUG_WARNING
42-
#define DEBUG_WARNING(fmt, ...) Debug.print(DBG_WARNING, fmt, ## __VA_ARGS__)
43-
#endif
44-
45-
#ifndef DEBUG_INFO
46-
#define DEBUG_INFO(fmt, ...) Debug.print(DBG_INFO, fmt, ## __VA_ARGS__)
47-
#endif
48-
49-
#ifndef DEBUG_DEBUG
50-
#define DEBUG_DEBUG(fmt, ...) Debug.print(DBG_DEBUG, fmt, ## __VA_ARGS__)
37+
#if defined __has_include
38+
#if !__has_include (<Arduino_DebugUtils.h>)
39+
#define DEBUG_ERROR (void) 0
40+
#define DEBUG_WARNING (void) 0
41+
#define DEBUG_INFO (void) 0
42+
#define DEBUG_DEBUG (void) 0
43+
#define DEBUG_VERBOSE (void) 0
44+
#endif
5145
#endif
5246

53-
#ifndef DEBUG_VERBOSE
54-
#define DEBUG_VERBOSE(fmt, ...) //Debug.print(DBG_VERBOSE, fmt, ## __VA_ARGS__)
55-
#endif
47+
// include directives must be ordered in such a way that this always comes first,
48+
// otherwise the log level will be incorrectly set
49+
#ifndef DEBUG_LEVEL
50+
#define DEBUG_LEVEL DEBUG_LEVEL_INFO
51+
#endif // DEBUG_LEVEL
52+
// #include <Arduino_DebugUtils.h>
5653

5754
/******************************************************************************
5855
* AUTOMATICALLY CONFIGURED DEFINES

0 commit comments

Comments
 (0)