-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfbbc5e
commit eaee121
Showing
4 changed files
with
83 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @file log_.h | ||
* @brief Log levels and macros | ||
* @details This file contains the log levels and macros for logging. | ||
* These exist to enable the library to used in different environments, | ||
* namely the ESP-IDF and the Arduino framework. | ||
*/ | ||
#ifndef LOG__H_ | ||
#define LOG__H_ | ||
|
||
#include <Arduino.h> | ||
|
||
#ifndef LOG_LEVEL_NONE | ||
#define LOG_LEVEL_NONE 0 | ||
#endif | ||
|
||
#ifndef LOG_LEVEL_ERROR | ||
#define LOG_LEVEL_ERROR 1 | ||
#endif | ||
|
||
#ifndef LOG_LEVEL_WARN | ||
#define LOG_LEVEL_WARN 2 | ||
#endif | ||
|
||
#ifndef LOG_LEVEL_INFO | ||
#define LOG_LEVEL_INFO 3 | ||
#endif | ||
|
||
#ifndef LOG_LEVEL_DEBUG | ||
#define LOG_LEVEL_DEBUG 4 | ||
#endif | ||
|
||
#ifndef LOG_LEVEL_VERBOSE | ||
#define LOG_LEVEL_VERBOSE 5 | ||
#endif | ||
|
||
#ifndef LOG_LEVEL | ||
#define LOG_LEVEL LOG_LEVEL_VERBOSE // Change this to set the log level | ||
#endif | ||
|
||
#ifndef log_e | ||
#define log_e(...) if (LOG_LEVEL >= LOG_LEVEL_ERROR) { Serial.printf("E ("); Serial.printf(__VA_ARGS__); Serial.println(")"); } | ||
#endif | ||
|
||
#ifndef log_w | ||
#define log_w(...) if (LOG_LEVEL >= LOG_LEVEL_WARN) { Serial.printf("W ("); Serial.printf(__VA_ARGS__); Serial.println(")"); } | ||
#endif | ||
|
||
#ifndef log_i | ||
#define log_i(...) if (LOG_LEVEL >= LOG_LEVEL_INFO) { Serial.printf("I ("); Serial.printf(__VA_ARGS__); Serial.println(")"); } | ||
#endif | ||
|
||
#ifndef log_d | ||
#define log_d(...) if (LOG_LEVEL >= LOG_LEVEL_DEBUG) { Serial.printf("D ("); Serial.printf(__VA_ARGS__); Serial.println(")"); } | ||
#endif | ||
|
||
#ifndef log_v | ||
#define log_v(...) if (LOG_LEVEL >= LOG_LEVEL_VERBOSE) { Serial.printf("V ("); Serial.printf(__VA_ARGS__); Serial.println(")"); } | ||
#endif | ||
|
||
#endif // LOG__H_ |