renamed namepsace for printers

This commit is contained in:
Robin Müller 2021-01-12 13:12:44 +01:00
parent e497c4ab15
commit 071ce21f09
3 changed files with 32 additions and 32 deletions

View File

@ -6,7 +6,7 @@
#include <cstdarg>
#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
static bool consoleInitialized = false;
#endif /* defined(WIN32) && FSFW_COLORED_OUTPUT == 1 */
@ -15,7 +15,7 @@ static bool addCrAtEnd = false;
#if FSFW_DISABLE_PRINTOUT == 0
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(not consoleInitialized) {
@ -32,38 +32,38 @@ void fsfwPrint(fsfw::PrintLevel printType, const char* fmt, va_list arg) {
char* bufferPosition = reinterpret_cast<char*>(printBuffer);
/* Check logger level */
if(printType == fsfw::PrintLevel::NONE or printType > printLevel) {
if(printType == sif::PrintLevel::NONE or printType > printLevel) {
return;
}
/* Log message to terminal */
#if FSFW_COLORED_OUTPUT == 1
if(printType == fsfw::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_GREEN);
if(printType == sif::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_GREEN);
}
else if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_MAGENTA);
else if(printType == sif::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_MAGENTA);
}
else if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_YELLOW);
else if(printType == sif::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_YELLOW);
}
else if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition, fsfw::ANSI_COLOR_RED);
else if(printType == sif::PrintLevel::ERROR_LEVEL) {
len += sprintf(bufferPosition, sif::ANSI_COLOR_RED);
}
#endif
if (printType == fsfw::PrintLevel::INFO_LEVEL) {
if (printType == sif::PrintLevel::INFO_LEVEL) {
len += sprintf(bufferPosition + len, "INFO: ");
}
if(printType == fsfw::PrintLevel::DEBUG_LEVEL) {
if(printType == sif::PrintLevel::DEBUG_LEVEL) {
len += sprintf(bufferPosition + len, "DEBUG: ");
}
if(printType == fsfw::PrintLevel::WARNING_LEVEL) {
if(printType == sif::PrintLevel::WARNING_LEVEL) {
len += sprintf(bufferPosition + len, "WARNING: ");
}
if(printType == fsfw::PrintLevel::ERROR_LEVEL) {
if(printType == sif::PrintLevel::ERROR_LEVEL) {
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_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::INFO_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::INFO_LEVEL, fmt, args);
va_end(args);
}
void fsfw::printWarning(const char *fmt, ...) {
void sif::printWarning(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::WARNING_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::WARNING_LEVEL, fmt, args);
va_end(args);
}
void fsfw::printDebug(const char *fmt, ...) {
void sif::printDebug(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::DEBUG_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::DEBUG_LEVEL, fmt, args);
va_end(args);
}
void fsfw::setToAddCrAtEnd(bool addCrAtEnd_) {
void sif::setToAddCrAtEnd(bool addCrAtEnd_) {
addCrAtEnd = addCrAtEnd_;
}
void fsfw::printError(const char *fmt, ...) {
void sif::printError(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
fsfwPrint(fsfw::PrintLevel::ERROR_LEVEL, fmt, args);
fsfwPrint(sif::PrintLevel::ERROR_LEVEL, 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, ...) {}
void sif::printInfo(const char *fmt, ...) {}
void sif::printWarning(const char *fmt, ...) {}
void sif::printDebug(const char *fmt, ...) {}
void sif::printError(const char *fmt, ...) {}
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
void fsfw::setPrintLevel(PrintLevel printLevel_) {
void sif::setPrintLevel(PrintLevel printLevel_) {
printLevel = printLevel_;
}
fsfw::PrintLevel fsfw::getPrintLevel() {
sif::PrintLevel sif::getPrintLevel() {
return printLevel;
}

View File

@ -2,7 +2,7 @@
#include <cstdio>
#endif
namespace fsfw {
namespace sif {
enum PrintLevel {
NONE = 0,

View File

@ -1,7 +1,7 @@
#ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
#define FSFW_SERVICEINTERFACE_SERVICEINTERFACEDEFINTIONS_H_
namespace fsfw {
namespace sif {
enum class OutputTypes {
OUT_INFO,