renamed namepsace for printers
This commit is contained in:
parent
e497c4ab15
commit
071ce21f09
@ -6,7 +6,7 @@
|
|||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
static fsfw::PrintLevel printLevel = fsfw::PrintLevel::DEBUG_LEVEL;
|
static sif::PrintLevel printLevel = sif::PrintLevel::DEBUG_LEVEL;
|
||||||
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
||||||
static bool consoleInitialized = false;
|
static bool consoleInitialized = false;
|
||||||
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
|
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
|
||||||
@ -15,7 +15,7 @@ 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];
|
||||||
|
|
||||||
void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
|
void fsfwPrint(sif::PrintLevel printType, const char* fmt, va_list arg) {
|
||||||
|
|
||||||
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
#if defined(WIN32) && FSFW_COLORED_OUTPUT == 1
|
||||||
if(not consoleInitialized) {
|
if(not consoleInitialized) {
|
||||||
@ -32,38 +32,38 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
|
|||||||
char* bufferPosition = reinterpret_cast<char*>(printBuffer);
|
char* bufferPosition = reinterpret_cast<char*>(printBuffer);
|
||||||
|
|
||||||
/* Check logger level */
|
/* Check logger level */
|
||||||
if(printType == fsfw::PrintLevel::NONE or printType > printLevel) {
|
if(printType == sif::PrintLevel::NONE or printType > printLevel) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Log message to terminal */
|
/* Log message to terminal */
|
||||||
|
|
||||||
#if FSFW_COLORED_OUTPUT == 1
|
#if FSFW_COLORED_OUTPUT == 1
|
||||||
if(printType == fsfw::PrintLevel::INFO_LEVEL) {
|
if(printType == sif::PrintLevel::INFO_LEVEL) {
|
||||||
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_GREEN);
|
len += sprintf(bufferPosition, sif::ANSI_COLOR_GREEN);
|
||||||
}
|
}
|
||||||
else if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
|
else if(printType == sif::PrintLevel::DEBUG_LEVEL) {
|
||||||
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_MAGENTA);
|
len += sprintf(bufferPosition, sif::ANSI_COLOR_MAGENTA);
|
||||||
}
|
}
|
||||||
else if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
|
else if(printType == sif::PrintLevel::WARNING_LEVEL) {
|
||||||
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_YELLOW);
|
len += sprintf(bufferPosition, sif::ANSI_COLOR_YELLOW);
|
||||||
}
|
}
|
||||||
else if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
|
else if(printType == sif::PrintLevel::ERROR_LEVEL) {
|
||||||
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_RED);
|
len += sprintf(bufferPosition, sif::ANSI_COLOR_RED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (printType == fsfw::PrintLevel::INFO_LEVEL) {
|
if (printType == sif::PrintLevel::INFO_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "INFO: ");
|
len += sprintf(bufferPosition + len, "INFO: ");
|
||||||
}
|
}
|
||||||
if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
|
if(printType == sif::PrintLevel::DEBUG_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "DEBUG: ");
|
len += sprintf(bufferPosition + len, "DEBUG: ");
|
||||||
}
|
}
|
||||||
if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
|
if(printType == sif::PrintLevel::WARNING_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "WARNING: ");
|
len += sprintf(bufferPosition + len, "WARNING: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
|
if(printType == sif::PrintLevel::ERROR_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "ERROR: ");
|
len += sprintf(bufferPosition + len, "ERROR: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,51 +88,51 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fsfw::printInfo(const char *fmt, ...) {
|
void sif::printInfo(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::INFO_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::INFO_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsfw::printWarning(const char *fmt, ...) {
|
void sif::printWarning(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::WARNING_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::WARNING_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsfw::printDebug(const char *fmt, ...) {
|
void sif::printDebug(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::DEBUG_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::DEBUG_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsfw::setToAddCrAtEnd(bool addCrAtEnd_) {
|
void sif::setToAddCrAtEnd(bool addCrAtEnd_) {
|
||||||
addCrAtEnd = addCrAtEnd_;
|
addCrAtEnd = addCrAtEnd_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsfw::printError(const char *fmt, ...) {
|
void sif::printError(const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
fsfwPrint(fsfw::PrintLevel::ERROR_LEVEL, fmt, args);
|
fsfwPrint(sif::PrintLevel::ERROR_LEVEL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void fsfw::printInfo(const char *fmt, ...) {}
|
void sif::printInfo(const char *fmt, ...) {}
|
||||||
void fsfw::printWarning(const char *fmt, ...) {}
|
void sif::printWarning(const char *fmt, ...) {}
|
||||||
void fsfw::printDebug(const char *fmt, ...) {}
|
void sif::printDebug(const char *fmt, ...) {}
|
||||||
void fsfw::printError(const char *fmt, ...) {}
|
void sif::printError(const char *fmt, ...) {}
|
||||||
|
|
||||||
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||||
|
|
||||||
void fsfw::setPrintLevel(PrintLevel printLevel_) {
|
void sif::setPrintLevel(PrintLevel printLevel_) {
|
||||||
printLevel = printLevel_;
|
printLevel = printLevel_;
|
||||||
}
|
}
|
||||||
|
|
||||||
fsfw::PrintLevel fsfw::getPrintLevel() {
|
sif::PrintLevel sif::getPrintLevel() {
|
||||||
return printLevel;
|
return printLevel;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace fsfw {
|
namespace sif {
|
||||||
|
|
||||||
enum PrintLevel {
|
enum PrintLevel {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
|
#ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
|
||||||
#define FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
|
#define FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
|
||||||
|
|
||||||
namespace fsfw {
|
namespace sif {
|
||||||
|
|
||||||
enum class OutputTypes {
|
enum class OutputTypes {
|
||||||
OUT_INFO,
|
OUT_INFO,
|
||||||
|
Loading…
Reference in New Issue
Block a user