enum members renamed, global vars static now

This commit is contained in:
Robin Müller 2021-01-08 20:55:36 +01:00
parent 7c47b1ce34
commit 12091ca6ab
2 changed files with 19 additions and 19 deletions

View File

@ -6,11 +6,11 @@
#include <cstdarg>
#include <cstdint>
fsfw::PrintLevel printLevel = fsfw::PrintLevel::DEBUG;
static fsfw::PrintLevel printLevel = fsfw::PrintLevel::DEBUG_LEVEL;
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
bool consoleInitialized = false;
static bool consoleInitialized = false;
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
bool addCrAtEnd = false;
static bool addCrAtEnd = false;
#if FSFW_DISABLE_PRINTOUT == 0
uint8_t printBuffer[fsfwconfig::FSFW_PRINT_BUFFER_SIZE];
@ -39,31 +39,31 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
/* Log message to terminal */
#if FSFW_COLORED_OUTPUT == 1
if(printType == fsfw::PrintLevel::INFO) {
if(printType == fsfw::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_GREEN);
}
else if(printType == fsfw::PrintLevel::DEBUG) {
else if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_MAGENTA);
}
else if(printType == fsfw::PrintLevel::WARNING) {
else if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_YELLOW);
}
else if(printType == fsfw::PrintLevel::ERROR_TYPE) {
else if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_RED);
}
#endif
if (printType == fsfw::PrintLevel::INFO) {
if (printType == fsfw::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition + len, "INFO: ");
}
if(printType == fsfw::PrintLevel::DEBUG) {
if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition + len, "DEBUG: ");
}
if(printType == fsfw::PrintLevel::WARNING) {
if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition + len, "WARNING: ");
}
if(printType == fsfw::PrintLevel::ERROR_TYPE) {
if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition + len, "ERROR: ");
}
@ -91,21 +91,21 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
void fsfw::printInfo(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::INFO, fmt, args);
fsfwPrint(fsfw::PrintLevel::INFO_LEVEL, fmt, args);
va_end(args);
}
void fsfw::printWarning(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::WARNING, fmt, args);
fsfwPrint(fsfw::PrintLevel::WARNING_LEVEL, fmt, args);
va_end(args);
}
void fsfw::printDebug(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::DEBUG, fmt, args);
fsfwPrint(fsfw::PrintLevel::DEBUG_LEVEL, fmt, args);
va_end(args);
}
@ -116,7 +116,7 @@ void fsfw::setToAddCrAtEnd(bool addCrAtEnd_) {
void fsfw::printError(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::ERROR_TYPE, fmt, args);
fsfwPrint(fsfw::PrintLevel::ERROR_LEVEL, fmt, args);
va_end(args);
}

View File

@ -7,10 +7,10 @@ namespace fsfw {
enum PrintLevel {
NONE = 0,
//! Strange error when using just ERROR..
ERROR_TYPE = 1,
WARNING = 2,
INFO = 3,
DEBUG = 4
ERROR_LEVEL = 1,
WARNING_LEVEL = 2,
INFO_LEVEL = 3,
DEBUG_LEVEL = 4
};
/**