REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
This class holds a finite size log (i.e. More...
#include <jsonl_logging.h>


Public Member Functions | |
StartupLog () | |
bool | is_active () |
virtual size_t | write (uint8_t b) override |
void | disable () |
void | stream_to_json (utils::StreamingJson &s) |
Static Public Member Functions | |
static StartupLog & | get () |
Public Attributes | |
msg::ring_buffer< std::string > | buf {max_buf_size} |
std::string | linebuf = "" |
Static Public Attributes | |
static constexpr size_t | max_buf_size = 60 |
Detailed Description
This class holds a finite size log (i.e.
list of strings) as a ring buffer. This log is supposed to be wiped as soon as the RAM is needed, i.e. at data aquisition.
We log full JSON messages here, which is not so memory efficient. Could do better.
Don't use this class directly, log to the Log class instead.
There is only one instance to simplify access along the code. Should be probably improved.
Definition at line 87 of file jsonl_logging.h.
Constructor & Destructor Documentation
◆ StartupLog()
|
inline |
Definition at line 92 of file jsonl_logging.h.
References linebuf.
Member Function Documentation
◆ disable()
|
inline |
Definition at line 108 of file jsonl_logging.h.
References buf, msg::ring_buffer< T >::clear(), linebuf, and msg::ring_buffer< T >::max_size.
◆ get()
|
inlinestatic |
Definition at line 117 of file jsonl_logging.h.
Referenced by msg::handlers::SyslogHandler::handle(), and setup().
◆ is_active()
|
inline |
Definition at line 94 of file jsonl_logging.h.
References buf, and msg::ring_buffer< T >::max_size.
◆ stream_to_json()
FLASHMEM void msg::StartupLog::stream_to_json | ( | utils::StreamingJson & | s | ) |
Definition at line 34 of file json_logging.cpp.
References utils::StreamingJson::begin_dict(), utils::StreamingJson::begin_list(), utils::StreamingJson::end_dict(), utils::StreamingJson::end_list(), utils::StreamingJson::json(), utils::StreamingJson::key(), and utils::StreamingJson::kv().
Referenced by msg::handlers::SyslogHandler::handle().
◆ write()
|
inlineoverridevirtual |
Definition at line 96 of file jsonl_logging.h.
References buf, linebuf, and msg::ring_buffer< T >::push_back().
Member Data Documentation
◆ buf
msg::ring_buffer<std::string> msg::StartupLog::buf {max_buf_size} |
Definition at line 89 of file jsonl_logging.h.
Referenced by disable(), is_active(), and write().
◆ linebuf
std::string msg::StartupLog::linebuf = "" |
Definition at line 90 of file jsonl_logging.h.
Referenced by disable(), StartupLog(), and write().
◆ max_buf_size
|
staticconstexpr |
Definition at line 88 of file jsonl_logging.h.
The documentation for this struct was generated from the following files:
- lib/communication/src/protocol/jsonl_logging.h
- lib/communication/src/protocol/json_logging.cpp