Log
Dependents: oldheating gps motorhome heating
Diff: log.cpp
- Revision:
- 8:e793e9005f89
- Parent:
- 7:417a6a65e942
- Child:
- 9:d2c41855ed09
--- a/log.cpp Mon Jul 03 14:27:15 2017 +0000 +++ b/log.cpp Fri Sep 22 13:40:50 2017 +0000 @@ -81,12 +81,16 @@ pPull = buffer; return 0; } +void Log(char* snd) +{ + for (char* ptr = snd; *ptr; ptr++) LogPush(*ptr); //Send the string to the log buffer +} void LogV(char *fmt, va_list argptr) { - int size = vsnprintf(NULL, 0, fmt, argptr); //Find the size required - char snd[size + 1]; //Allocate enough memory for the size required with an extra byte for the terminating null - vsprintf(snd, fmt, argptr); //Fill the new buffer - for (char* ptr = snd; *ptr; ptr++) LogPush(*ptr); //Send the string to the log buffer + int size = vsnprintf(NULL, 0, fmt, argptr); //Find the size required + char snd[size + 1]; //Allocate enough memory for the size required with an extra byte for the terminating null + vsprintf(snd, fmt, argptr); //Fill the new buffer + Log(snd); //Send the string to the log buffer } void LogF(char *fmt, ...) { @@ -95,10 +99,6 @@ LogV(fmt, argptr); va_end(argptr); } -void LogCrLf (char * text) -{ - LogF("%s\r\n", text); -} static void pushuint4(int value) { if (value > 9999) { LogPush('+'); LogPush('+'); LogPush('+'); LogPush('+'); }