Skip to content

Commit 1585021

Browse files
improving logging level values
Improve values of logging level to allow for bitwise operations for bitmask instead of comparison operator
1 parent 28a913d commit 1585021

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

src/Arduino_DebugUtils.h

+20-11
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,17 @@
2626

2727
#include <stdarg.h>
2828

29-
/******************************************************************************
30-
CONSTANTS
31-
******************************************************************************/
32-
33-
static int const DBG_NONE = -1;
34-
static int const DBG_ERROR = 0;
35-
static int const DBG_WARNING = 1;
36-
static int const DBG_INFO = 2;
37-
static int const DBG_DEBUG = 3;
38-
static int const DBG_VERBOSE = 4;
39-
4029
void setDebugMessageLevel(int const debug_level);
4130
int getDebugMessageLevel();
4231

32+
#define DEBUG_LEVEL_NONE 0x0000
33+
#define DEBUG_LEVEL_ERROR 0x0001
34+
#define DEBUG_LEVEL_WARNING 0x0003
35+
#define DEBUG_LEVEL_INFO 0x0007
36+
#define DEBUG_LEVEL_DEBUG 0x000F
37+
#define DEBUG_LEVEL_VERBOSE 0x001F
38+
#define DEBUG_LEVEL_ALL 0xFFFF
39+
4340
/******************************************************************************
4441
CLASS DECLARATION
4542
******************************************************************************/
@@ -87,6 +84,18 @@ class Arduino_DebugUtils {
8784

8885
};
8986

87+
/******************************************************************************
88+
CONSTANTS
89+
******************************************************************************/
90+
91+
static constexpr int DBG_NONE = DEBUG_LEVEL_NONE;
92+
static constexpr int DBG_ERROR = DEBUG_LEVEL_ERROR;
93+
static constexpr int DBG_WARNING = DEBUG_LEVEL_WARNING;
94+
static constexpr int DBG_INFO = DEBUG_LEVEL_INFO;
95+
static constexpr int DBG_DEBUG = DEBUG_LEVEL_DEBUG;
96+
static constexpr int DBG_VERBOSE = DEBUG_LEVEL_VERBOSE;
97+
static constexpr int DBG_ALL = DEBUG_LEVEL_ALL;
98+
9099
/******************************************************************************
91100
EXTERN
92101
******************************************************************************/

0 commit comments

Comments
 (0)