AceTime  0.3
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
logger.h
1 /*
2  * Implement logger::print() and logger::println() that accept formatting
3  * strings like printf(). I finally got tired of writing multiple lines of
4  * Serial.print() for debugging.
5  */
6 
7 #ifndef ACE_TIME_COMMON_LOGGING_H
8 #define ACE_TIME_COMMON_LOGGING_H
9 
10 namespace ace_time {
11 namespace logging {
12 
13 #include <stdarg.h>
14 
15 inline void vprintf(const char *fmt, va_list args) {
16  char buf[192];
17  vsnprintf(buf, 192, fmt, args);
18  Serial.print(buf);
19 }
20 
22 inline void print(const char* fmt, ...) {
23  va_list args;
24  va_start(args, fmt);
25  vprintf(fmt, args);
26  va_end(args);
27 }
28 
33 inline void println(const char *fmt, ... ) {
34  va_list args;
35  va_start(args, fmt);
36  vprintf(fmt, args);
37  va_end(args);
38  Serial.println();
39 }
40 
42 inline void println() {
43  Serial.println();
44 }
45 
46 }
47 }
48 
49 #endif