F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Logger.hpp
Go to the documentation of this file.
1 
9 #ifndef Fw_Logger_hpp_
10 #define Fw_Logger_hpp_
11 #include <FpConfig.hpp>
12 #include <Fw/Deprecate.hpp>
13 #include <Fw/Types/StringBase.hpp>
14 
15 // Unit testing predeclaration hook
16 namespace LoggerRules {
17 struct Register;
18 }
19 
20 namespace Fw {
21 class Logger {
22  friend struct LoggerRules::Register;
23 
24  public:
32  static void log(const char* format, ...);
33 
38  static void log(const Fw::StringBase& message);
39 
44  static void registerLogger(Logger* logger);
45 
47  virtual ~Logger() = default;
48 
49  protected:
55  virtual void writeMessage(const StringBase& message) = 0;
56 
57  private:
58  static Logger* s_current_logger;
59 };
60 } // namespace Fw
61 
62 #endif
C++-compatible configuration header for fprime configuration.
Declares F Prime string base class.
friend struct LoggerRules::Register
Definition: Logger.hpp:22
static void registerLogger(Logger *logger)
register a logger implementation
Definition: Logger.cpp:37
static void log(const char *format,...)
log a formated string with supplied arguments
Definition: Logger.cpp:21
virtual ~Logger()=default
Virtual destructor.
virtual void writeMessage(const StringBase &message)=0
write the output of the log message