REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches

This class holds a finite size log (i.e. More...

#include <jsonl_logging.h>

Inheritance diagram for msg::StartupLog:
Collaboration diagram for msg::StartupLog:

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 StartupLogget ()
 

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()

msg::StartupLog::StartupLog ( )
inline

Definition at line 92 of file jsonl_logging.h.

References linebuf.

Member Function Documentation

◆ disable()

void msg::StartupLog::disable ( )
inline

◆ get()

static StartupLog & msg::StartupLog::get ( )
inlinestatic

Definition at line 117 of file jsonl_logging.h.

Referenced by msg::handlers::SyslogHandler::handle(), and setup().

◆ is_active()

bool msg::StartupLog::is_active ( )
inline

Definition at line 94 of file jsonl_logging.h.

References buf, and msg::ring_buffer< T >::max_size.

◆ stream_to_json()

◆ write()

virtual size_t msg::StartupLog::write ( uint8_t b)
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

size_t msg::StartupLog::max_buf_size = 60
staticconstexpr

Definition at line 88 of file jsonl_logging.h.


The documentation for this struct was generated from the following files: