F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
ConsoleTextLoggerImplCommon.cpp
Go to the documentation of this file.
2 #include <FpConfig.hpp>
3 #include <Fw/Types/Assert.hpp>
4 #include <Fw/Logger/Logger.hpp>
5 
6 namespace Svc {
7 
10  }
11 
13 
14  void ConsoleTextLoggerImpl::TextLogger_handler(NATIVE_INT_TYPE portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity& severity, Fw::TextLogString &text) {
15  const char *severityString = "UNKNOWN";
16  switch (severity.e) {
18  severityString = "FATAL";
19  break;
21  severityString = "WARNING_HI";
22  break;
24  severityString = "WARNING_LO";
25  break;
27  severityString = "COMMAND";
28  break;
30  severityString = "ACTIVITY_HI";
31  break;
33  severityString = "ACTIVITY_LO";
34  break;
36  severityString = "DIAGNOSTIC";
37  break;
38  default:
39  severityString = "SEVERITY ERROR";
40  break;
41  }
42  Fw::Logger::log("EVENT: (%" PRI_FwEventIdType ") (%" PRI_FwTimeBaseStoreType ":%" PRIu32 ",%" PRIu32 ") %s: %s\n",
43  id, static_cast<FwTimeBaseStoreType>(timeTag.getTimeBase()), timeTag.getSeconds(), timeTag.getUSeconds(),
44  reinterpret_cast<PlatformPointerCastType>(severityString), reinterpret_cast<PlatformPointerCastType>(text.toChar()));
45  }
46 }
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
uint8_t PlatformPointerCastType
U32 FwEventIdType
Definition: FpConfig.h:103
U16 FwTimeBaseStoreType
Definition: FpConfig.h:79
#define PRI_FwEventIdType
Definition: FpConfig.h:104
#define PRI_FwTimeBaseStoreType
Definition: FpConfig.h:80
C++-compatible configuration header for fprime configuration.
Enum representing event severity.
T e
The raw enum value.
@ WARNING_HI
A serious but recoverable event.
@ ACTIVITY_HI
Important informational events.
@ FATAL
A fatal non-recoverable event.
@ WARNING_LO
A less serious but recoverable event.
@ DIAGNOSTIC
Software diagnostic events.
@ ACTIVITY_LO
Less important informational events.
@ COMMAND
An activity related to commanding.
static void log(const char *format,...)
log a formated string with supplied arguments
Definition: Logger.cpp:21
const char * toChar() const
Definition: Time.hpp:9
U32 getUSeconds() const
Definition: Time.cpp:139
TimeBase getTimeBase() const
Definition: Time.cpp:143
U32 getSeconds() const
Definition: Time.cpp:135
ConsoleTextLoggerImpl(const char *compName)
Auto-generated base for PassiveTextLogger component.