RF24Log  0.1.3
Unified logging library
AbstractHandler.cpp
Go to the documentation of this file.
1 
15 #include "AbstractHandler.h"
16 
17 /****************************************************************************/
18 
20 {
22 }
23 
24 /****************************************************************************/
25 
26 void RF24LogAbstractHandler::log(uint8_t logLevel,
27  const char *vendorId,
28  const char *message,
29  va_list *args)
30 {
31  if (isLevelEnabled(logLevel))
32  {
33  write(logLevel, vendorId, message, args);
34  }
35 }
36 
37 /****************************************************************************/
38 
39 #if defined (ARDUINO_ARCH_AVR)
40 void RF24LogAbstractHandler::log(uint8_t logLevel,
41  const __FlashStringHelper *vendorId,
42  const __FlashStringHelper *message,
43  va_list *args)
44 {
45  if (isLevelEnabled(logLevel))
46  {
47  write(logLevel, vendorId, message, args);
48  }
49 }
50 #endif
51 
52 /****************************************************************************/
53 
55 {
56  _logLevel = logLevel;
57 }
58 
59 /****************************************************************************/
60 
61 bool RF24LogAbstractHandler::isLevelEnabled(uint8_t logLevel)
62 {
63  return logLevel <= _logLevel;
64 }
abstract class that allows custom handlers agnostic to any output stream APIs
void log(uint8_t logLevel, const char *vendorId, const char *message, va_list *args)
log a message.
RF24LogAbstractHandler()
Sets log level to INFO upon instantiation.
virtual void write(uint8_t logLevel, const char *vendorId, const char *message, va_list *args)=0
void setLogLevel(uint8_t logLevel)
@ INFO
Definition: RF24LogLevel.h:47