Merge pull request 'Printer updates' (#453) from mueller/updated-serviceinterface into mueller/restructuring

Reviewed-on: fsfw/fsfw#453
This commit is contained in:
Ulrich Mohr 2021-08-09 15:24:44 +02:00
commit 1c3770ce96
2 changed files with 11 additions and 7 deletions

View File

@ -146,8 +146,8 @@ std::string* ServiceInterfaceBuffer::getPreamble(size_t * preambleSize) {
#endif
int32_t charCount = sprintf(parsePosition,
"%s: | %02" SCNu32 ":%02" SCNu32 ":%02" SCNu32 ".%03" SCNu32 " | ",
this->logMessage.c_str(), loggerTime.hour,
"%s%s | %02" SCNu32 ":%02" SCNu32 ":%02" SCNu32 ".%03" SCNu32 " | ",
this->logMessage.c_str(), sif::ANSI_COLOR_RESET, loggerTime.hour,
loggerTime.minute,
loggerTime.second,
loggerTime.usecond /1000);

View File

@ -56,25 +56,29 @@ void fsfwPrint(sif::PrintLevel printType, const char* fmt, va_list arg) {
#endif
if (printType == sif::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition + len, "INFO: ");
len += sprintf(bufferPosition + len, "INFO");
}
if(printType == sif::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition + len, "DEBUG: ");
len += sprintf(bufferPosition + len, "DEBUG");
}
if(printType == sif::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition + len, "WARNING: ");
len += sprintf(bufferPosition + len, "WARNING");
}
if(printType == sif::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition + len, "ERROR: ");
len += sprintf(bufferPosition + len, "ERROR");
}
#if FSFW_COLORED_OUTPUT == 1
len += sprintf(bufferPosition + len, sif::ANSI_COLOR_RESET);
#endif
Clock::TimeOfDay_t now;
Clock::getDateAndTime(&now);
/*
* Log current time to terminal if desired.
*/
len += sprintf(bufferPosition + len, "| %lu:%02lu:%02lu.%03lu | ",
len += sprintf(bufferPosition + len, " | %lu:%02lu:%02lu.%03lu | ",
(unsigned long) now.hour,
(unsigned long) now.minute,
(unsigned long) now.second,