F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
Logger.cpp
Go to the documentation of this file.
1
10#include <Fw/Types/Assert.hpp>
11#include <Fw/Types/String.hpp>
13#include <cstdarg>
14#include <limits>
15
16namespace Fw {
17
18// Initial logger is NULL
19Logger* Logger::s_current_logger = nullptr;
20
21void Logger::log(const char* format, ...) {
22 Fw::String formatted_string;
23 // Forward the variable arguments to the vformat format implementation
24 va_list args;
25 va_start(args, format);
26 formatted_string.vformat(format, args);
27 va_end(args);
28 Logger::log(formatted_string);
29}
30
31void Logger::log(const StringBase& string) {
32 if (Logger::s_current_logger != nullptr) {
33 Logger::s_current_logger->writeMessage(string);
34 }
35}
36
38 Logger::s_current_logger = logger;
39}
40
41} // End namespace Fw
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
void vformat(const CHAR *formatString, va_list args)
write formatted string to buffer using va_list