Skip to content

Improving Logging by using Arduino_DebugUtils #48 #560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 15 additions & 17 deletions src/AIoTC_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +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
// 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

#ifndef DEBUG_DEBUG
#define DEBUG_DEBUG(fmt, ...) Debug.print(DBG_DEBUG, fmt, ## __VA_ARGS__)
#endif

#ifndef DEBUG_VERBOSE
#define DEBUG_VERBOSE(fmt, ...) //Debug.print(DBG_VERBOSE, fmt, ## __VA_ARGS__)
#if defined __has_include
#if !__has_include (<Arduino_DebugUtils.h>)
#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
#elif defined(__cplusplus)
#include <Arduino_DebugUtils.h>
#endif
#endif

/******************************************************************************
Expand Down
Loading