1
0
forked from fsfw/fsfw

added way to completely disable printouts

This commit is contained in:
2021-01-06 19:49:58 +01:00
parent db7d28f852
commit 91cf5f1764
5 changed files with 38 additions and 19 deletions

View File

@ -6,12 +6,14 @@
#include <cstdarg>
#include <cstdint>
fsfw::PrintLevel printLevel = fsfw::PrintLevel::DEBUG;
uint8_t printBuffer[fsfwconfig::FSFW_PRINT_BUFFER_SIZE];
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
bool consoleInitialized = false;
#endif
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
#if FSFW_DISABLE_PRINTOUT == 0
uint8_t printBuffer[fsfwconfig::FSFW_PRINT_BUFFER_SIZE];
void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
@ -81,13 +83,6 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
printf("%s", printBuffer);
}
void fsfw::setPrintLevel(PrintLevel printLevel_) {
printLevel = printLevel_;
}
fsfw::PrintLevel fsfw::getPrintLevel() {
return printLevel;
}
void fsfw::printInfo(const char *fmt, ...) {
va_list args;
@ -116,3 +111,20 @@ void fsfw::printError(const char *fmt, ...) {
fsfwPrint(fsfw::PrintLevel::ERROR_TYPE, fmt, args);
va_end(args);
}
#else
void fsfw::printInfo(const char *fmt, ...) {}
void fsfw::printWarning(const char *fmt, ...) {}
void fsfw::printDebug(const char *fmt, ...) {}
void fsfw::printError(const char *fmt, ...) {}
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
void fsfw::setPrintLevel(PrintLevel printLevel_) {
printLevel = printLevel_;
}
fsfw::PrintLevel fsfw::getPrintLevel() {
return printLevel;
}

View File

@ -1,4 +1,6 @@
#if FSFW_DISABLE_PRINTOUT == 0
#include <stdio.h>
#endif
namespace fsfw {