Skyward boardcore
|
Buffered logger. Needs to be started before it can be used. More...
#include <Logger.h>
Public Member Functions | |
bool | start () |
Call this function to start the logger. | |
void | stop () |
Call this function to stop the logger. | |
int | getCurrentLogNumber () |
std::string | getCurrentFileName () |
LoggerStats | getStats () |
void | resetStats () |
bool | isStarted () const |
template<typename T > | |
LoggerResult | log (const T &t) |
Call this function to log a class. | |
void | logStats () |
Log logger stats using the logger itself. | |
![]() | |
Singleton (const Singleton &)=delete | |
Singleton & | operator= (const Singleton &)=delete |
Static Public Member Functions | |
static bool | testSDCard () |
Tests if the Logger can write to the SD card by opening a file. | |
static constexpr unsigned int | getMaxFilenameNumber () |
Returns the Max Filename number. | |
![]() | |
static Logger & | getInstance () |
Friends | |
class | Singleton< Logger > |
Additional Inherited Members | |
![]() | |
Singleton () | |
string Boardcore::Logger::getCurrentFileName | ( | ) |
Definition at line 140 of file Logger.cpp.
int Boardcore::Logger::getCurrentLogNumber | ( | ) |
Definition at line 138 of file Logger.cpp.
|
inlinestaticconstexpr |
LoggerStats Boardcore::Logger::getStats | ( | ) |
Definition at line 142 of file Logger.cpp.
bool Boardcore::Logger::isStarted | ( | ) | const |
Definition at line 163 of file Logger.cpp.
LoggerResult Boardcore::Logger::log | ( | const T & | t | ) |
Call this function to log a class.
Nonblocking call.
Refer to the TSCPP repository to know more about how the data is stored. https://git.skywarder.eu/scs/third-party/tscpp
T | The class to be logged. This class has the following requirements:
|
void Boardcore::Logger::logStats | ( | ) |
Log logger stats using the logger itself.
The stats are reset after being logged.
Definition at line 165 of file Logger.cpp.
void Boardcore::Logger::resetStats | ( | ) |
Definition at line 149 of file Logger.cpp.
bool Boardcore::Logger::start | ( | ) |
Call this function to start the logger.
Tries to start the logger, first opens the log file and then create the pack and write threads. If it fails on one of this operation, the logger is not started.
Use getCurrentLogNumber to retrieve the log file number.
Blocking call. May take a long time.
Definition at line 46 of file Logger.cpp.
void Boardcore::Logger::stop | ( | ) |
Call this function to stop the logger.
When this function returns, all log buffers have been flushed to disk, and it is safe to power down the board without losing log data or corrupting the filesystem.
Blocking call. May take a very long time (seconds).
Definition at line 111 of file Logger.cpp.
|
static |
Tests if the Logger can write to the SD card by opening a file.
Definition at line 131 of file Logger.cpp.