MCPcopy Create free account
hub / github.com/KlausMu/esp32-fan-controller / printf

Method printf

src/log.cpp:50–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50size_t LogStreamClass::printf(const char * format, ...) {
51// https://stackoverflow.com/questions/3530771/passing-variable-arguments-to-another-function-that-accepts-a-variable-argument
52// https://stackoverflow.com/questions/1056411/how-to-pass-variable-number-of-arguments-to-printf-sprintf
53
54 size_t res;
55 va_list args;
56 va_start(args, format);
57
58 // maximum number of characters in log message
59 char buf[1000];
60 vsnprintf(buf, sizeof(buf), format, args);
61
62 // print out #1: Serial
63 #if defined(useSerial)
64 res = Serial.printf(MY_LOG_FORMAT("%s"), buf);
65 #endif
66
67 // print out #2: TelnetStream
68 #if defined(useTelnetStream)
69 res = TelnetStream.printf(MY_LOG_FORMAT("%s"), buf);
70 #endif
71
72 va_end(args);
73 return res;
74};
75
76LogStreamClass Log;
77

Callers 15

doLogFunction · 0.80
onClickFunction · 0.80
ifFunction · 0.80
initTFTtouchFunction · 0.80
initTFTFunction · 0.80
printTextFunction · 0.80
switchOff_screenFunction · 0.80
draw_screenFunction · 0.80
printWiFiStatusFunction · 0.80
WiFiStationConnectedFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected