SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
local_debug.h
Go to the documentation of this file.
1#ifndef SENSESP_SYSTEM_LOCAL_DEBUG_H_
2#define SENSESP_SYSTEM_LOCAL_DEBUG_H_
3
4#include "esp32-hal-log.h"
5
6#include "Arduino.h"
7#include "Print.h"
8
9#define rdebugA(fmt, ...) ESP_LOGV(__FILENAME__, fmt, ##__VA_ARGS__)
10#define rdebugP(fmt, ...) ESP_LOGV(__FILENAME__, fmt, ##__VA_ARGS__)
11#define rdebugV(fmt, ...) ESP_LOGV(__FILENAME__, fmt, ##__VA_ARGS__)
12#define rdebugD(fmt, ...) ESP_LOGD(__FILENAME__, fmt, ##__VA_ARGS__)
13#define rdebugI(fmt, ...) ESP_LOGI(__FILENAME__, fmt, ##__VA_ARGS__)
14#define rdebugW(fmt, ...) ESP_LOGW(__FILENAME__, fmt, ##__VA_ARGS__)
15#define rdebugE(fmt, ...) ESP_LOGE(__FILENAME__, fmt, ##__VA_ARGS__)
16
17// With newline
18
19#define rdebugAln(fmt, ...) rdebugA(fmt "\n", ##__VA_ARGS__)
20#define rdebugPln(fmt, ...) rdebugP(fmt "\n", ##__VA_ARGS__)
21#define rdebugVln(fmt, ...) rdebugV(fmt "\n", ##__VA_ARGS__)
22#define rdebugDln(fmt, ...) rdebugD(fmt "\n", ##__VA_ARGS__)
23#define rdebugIln(fmt, ...) rdebugI(fmt "\n", ##__VA_ARGS__)
24#define rdebugWln(fmt, ...) rdebugW(fmt "\n", ##__VA_ARGS__)
25#define rdebugEln(fmt, ...) rdebugE(fmt "\n", ##__VA_ARGS__)
26
27// New way: To compatibility with SerialDebug (can use RemoteDebug or
28// SerialDebug) This is my favorite :)
29
30#define debugV(fmt, ...) rdebugV(fmt, ##__VA_ARGS__)
31#define debugD(fmt, ...) rdebugD(fmt, ##__VA_ARGS__)
32#define debugI(fmt, ...) rdebugI(fmt, ##__VA_ARGS__)
33#define debugW(fmt, ...) rdebugW(fmt, ##__VA_ARGS__)
34#define debugE(fmt, ...) rdebugE(fmt, ##__VA_ARGS__)
35#define debugA(fmt, ...) rdebugV(fmt, ##__VA_ARGS__)
36
37namespace sensesp {
38
40 public:
41 bool begin(uint8_t startingDebugLevel = DEBUG);
42
43 void setSerialEnabled(bool enable) {} // No-op
44
45 void setResetCmdEnabled(bool enable) {} // No-op
46
47 boolean isActive(uint8_t debugLevel = DEBUG);
48
49 // Debug levels
50
51 static const uint8_t PROFILER =
52 0; // Used for show time of execution of pieces of code(profiler)
53 static const uint8_t VERBOSE = 1; // Used for show verboses messages
54 static const uint8_t DEBUG = 2; // Used for show debug messages
55 static const uint8_t INFO = 3; // Used for show info messages
56 static const uint8_t WARNING = 4; // Used for show warning messages
57 static const uint8_t ERROR = 5; // Used for show error messages
58 static const uint8_t ANY =
59 6; // Used for show always messages, for any current debug level
60
61 private:
62 uint8_t lastDebugLevel_ = DEBUG;
63};
64
65} // namespace sensesp
66
67#endif
void setSerialEnabled(bool enable)
Definition local_debug.h:43
static const uint8_t PROFILER
Definition local_debug.h:51
boolean isActive(uint8_t debugLevel=DEBUG)
static const uint8_t ANY
Definition local_debug.h:58
static const uint8_t VERBOSE
Definition local_debug.h:53
void setResetCmdEnabled(bool enable)
Definition local_debug.h:45
static const uint8_t DEBUG
Definition local_debug.h:54
static const uint8_t INFO
Definition local_debug.h:55
static const uint8_t WARNING
Definition local_debug.h:56
static const uint8_t ERROR
Definition local_debug.h:57
bool begin(uint8_t startingDebugLevel=DEBUG)