|
SatCat5
|
Helper object that prints log::Log messages to console.
Automatically calls log::start on creation and destruction. Stores the most recent log message, to facilitate unit tests.
Definition at line 213 of file posix_utils.h.
#include <posix_utils.h>
Public Member Functions | |
| ToConsole (s8 threshold=satcat5::log::DEBUG) | |
| On creation, optionally specify the minimum priority to print. | |
| void | disable () |
| Disable all output messages until threshold is lowered. | |
| void | suppress (const char *msg) |
| Suppress messages containing a specific string. More... | |
| bool | contains (const char *msg) |
| Does the last logged message contain the provided substring? | |
| void | clear () |
| Clear the stored copy of the most recent log message. | |
| bool | empty () |
| Is there a stored log message? | |
Public Attributes | |
| s8 | m_threshold |
| Print only if priority >= threshold. | |
| std::string | m_last_msg |
| Most recent message (ignores threshold) | |
Protected Member Functions | |
| void | log_event (s8 priority, unsigned nbytes, const char *msg) override |
| Callback for each formatted Log message. More... | |
Protected Attributes | |
| std::vector< std::string > | m_suppress |
| satcat5::util::PosixTimer | m_timer |
| satcat5::util::TimeVal | m_tref |
Private Attributes | |
| satcat5::log::EventHandler * | m_next |
|
overrideprotectedvirtual |
Callback for each formatted Log message.
Child class must override this method.)
Implements satcat5::log::EventHandler.
Definition at line 153 of file posix_utils.cc.
| void ToConsole::suppress | ( | const char * | msg | ) |
Suppress messages containing a specific string.
Filters are added to an internal list; null pointer clears the list.
Definition at line 145 of file posix_utils.cc.