RF24Log  0.1.3
Unified logging library
RF24Logging.cpp
Go to the documentation of this file.
1 
14 #include <RF24Logging.h>
15 
16 /****************************************************************************/
17 
19 {
20  this->handler = nullptr;
21 }
22 
23 /****************************************************************************/
24 
26 {
27  this->handler = handler;
28 }
29 
30 /****************************************************************************/
31 
32 void RF24Logging::log(uint8_t logLevel, const char *vendorId, const char *message, ...)
33 {
34  if (handler != nullptr)
35  {
36  va_list args;
37  va_start(args, message);
38  handler->log(logLevel, vendorId, message, &args);
39  va_end(args);
40  }
41 }
42 
43 /****************************************************************************/
44 
45 #if defined (ARDUINO_ARCH_AVR)
46 void RF24Logging::log(uint8_t logLevel, const __FlashStringHelper *vendorId, const __FlashStringHelper *message, ...)
47 {
48  if (handler != nullptr)
49  {
50  va_list args;
51  va_start(args, message);
52  handler->log(logLevel, vendorId, message, &args);
53  va_end(args);
54  }
55 }
56 #endif
57 
58 /****************************************************************************/
59 
Provides rf24Logging singleton for accessing the Logging API.
A base mechanism for handling log messages.
virtual void log(uint8_t logLevel, const char *vendorId, const char *message, va_list *args)=0
log a message.
This is the end-user's access point into the world of logging messages.
Definition: RF24Logging.h:93
void log(uint8_t logLevel, const char *vendorId, const char *message,...)
output a log message of any level
Definition: RF24Logging.cpp:32
RF24Logging()
Initializes the handler to nullptr.
Definition: RF24Logging.cpp:18
void setHandler(RF24LogBaseHandler *handler)
set the instance's handler
Definition: RF24Logging.cpp:25
RF24Logging rf24Logging
default logger instance
Definition: RF24Logging.cpp:61