enum members renamed, global vars static now
This commit is contained in:
parent
7c47b1ce34
commit
12091ca6ab
@ -6,11 +6,11 @@
|
|||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
fsfw::PrintLevel printLevel = fsfw::PrintLevel::DEBUG;
|
static fsfw::PrintLevel printLevel = fsfw::PrintLevel::DEBUG_LEVEL;
|
||||||
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
||||||
bool consoleInitialized = false;
|
static bool consoleInitialized = false;
|
||||||
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
|
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
|
||||||
bool addCrAtEnd = false;
|
static bool addCrAtEnd = false;
|
||||||
|
|
||||||
#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
uint8_t printBuffer[fsfwconfig::FSFW_PRINT_BUFFER_SIZE];
|
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 */
|
/* Log message to terminal */
|
||||||
|
|
||||||
#if FSFW_COLORED_OUTPUT == 1
|
#if FSFW_COLORED_OUTPUT == 1
|
||||||
if(printType == fsfw::PrintLevel::INFO) {
|
if(printType == fsfw::PrintLevel::INFO_LEVEL) {
|
||||||
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_GREEN);
|
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);
|
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);
|
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);
|
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_RED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (printType == fsfw::PrintLevel::INFO) {
|
if (printType == fsfw::PrintLevel::INFO_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "INFO: ");
|
len += sprintf(bufferPosition + len, "INFO: ");
|
||||||
}
|
}
|
||||||
if(printType == fsfw::PrintLevel::DEBUG) {
|
if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "DEBUG: ");
|
len += sprintf(bufferPosition + len, "DEBUG: ");
|
||||||
}
|
}
|
||||||
if(printType == fsfw::PrintLevel::WARNING) {
|
if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "WARNING: ");
|
len += sprintf(bufferPosition + len, "WARNING: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(printType == fsfw::PrintLevel::ERROR_TYPE) {
|
if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "ERROR: ");
|
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, ...) {
|
void fsfw::printInfo(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::INFO, fmt, args);
|
fsfwPrint(fsfw::PrintLevel::INFO_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsfw::printWarning(const char *fmt, ...) {
|
void fsfw::printWarning(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::WARNING, fmt, args);
|
fsfwPrint(fsfw::PrintLevel::WARNING_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsfw::printDebug(const char *fmt, ...) {
|
void fsfw::printDebug(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::DEBUG, fmt, args);
|
fsfwPrint(fsfw::PrintLevel::DEBUG_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ void fsfw::setToAddCrAtEnd(bool addCrAtEnd_) {
|
|||||||
void fsfw::printError(const char *fmt, ...) {
|
void fsfw::printError(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::ERROR_TYPE, fmt, args);
|
fsfwPrint(fsfw::PrintLevel::ERROR_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@ namespace fsfw {
|
|||||||
enum PrintLevel {
|
enum PrintLevel {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
//! Strange error when using just ERROR..
|
//! Strange error when using just ERROR..
|
||||||
ERROR_TYPE = 1,
|
ERROR_LEVEL = 1,
|
||||||
WARNING = 2,
|
WARNING_LEVEL = 2,
|
||||||
INFO = 3,
|
INFO_LEVEL = 3,
|
||||||
DEBUG = 4
|
DEBUG_LEVEL = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user