15 #include "../RF24LogLevel.h"
17 #include "../RF24LogBaseHandler.h"
24 if (!logLevel) {
return; }
25 #if !defined(RF24LOG_NO_TIMESTAMP)
35 uint8_t subLevel = logLevel & 0x07;
38 uint8_t logIndex = ((logLevel & 0x38) >> 3) - 1;
43 #if !defined(RF24LOG_TERSE_DESC) && !defined(RF24LOG_SHORT_DESC)
51 #if !defined(RF24LOG_TERSE_DESC) && !defined(RF24LOG_SHORT_DESC)
59 appendChar(
' ', logLevel < 010 ? 2 : (logLevel < 0100));
74 register char *str_p = (
char *)va_arg(*args,
int);
76 const char *str_p = va_arg(*args,
char *);
81 #ifdef ARDUINO_ARCH_AVR
85 register __FlashStringHelper *s = (__FlashStringHelper *)va_arg(*args,
int);
93 if (fmt_parser->
width)
103 double temp = va_arg(*args,
double);
107 if (fmt_parser->
precis == 0 && temp == 0.0) {
return; }
109 if (fmt_parser->
precis >= 0)
125 else if (fmt_parser->
specifier ==
'o') { base = 8; }
126 else if (fmt_parser->
specifier ==
'b') { base = 2; }
129 int temp = va_arg(*args,
int);
130 if (fmt_parser->
width)
135 if (fmt_parser->
length & 0x80)
138 else if (fmt_parser->
length == 8) {
appendUInt((
unsigned char)temp, base); }
140 else {
appendUInt((
unsigned long)temp, base); }
abstract class that allows using different output stream APIs
uint16_t numbCharsToPrint(int64_t numb, uint8_t base)
how wide (in characters) does it take to display a number
A collection of constants used to describe a particular logging level.
#define RF24LOG_DELIMITER
Change The Delimiter character used in the header prefix of log messages.
virtual void appendUInt(unsigned long data, uint8_t base=10)=0
append an ‘unsigned’ (only +) number
virtual void appendInt(long data)=0
append a signed (+/-) number
virtual void appendStr(const char *data)=0
append a c-string
void appendLogLevel(uint8_t logLevel)
output a description of the log level
virtual void appendChar(char data, uint16_t depth=1)=0
append a character a number of times
void appendFormat(FormatSpecifier *fmt_parser, va_list *args)
output a data according to the format specifier
virtual void appendTimestamp()=0
output a timestamp
void descTimeLevel(uint8_t logLevel)
Automate the output of the header' timestamp and level description.
virtual void appendDouble(double data, uint8_t precision=2)=0
append a floating point number
const char RF24LogDescLevel[]
description of the DEBUG base level
const char *const RF24LogDescLevels[]
collection of the base level descriptions