mitteLib
|
A utility class to contextually enable/disable some of ESP32 log levels. This class is RAII, so it will restore the original logging level when destroyed. More...
#include <log.hpp>
Public Member Functions | |
suppress_log ()=default | |
suppress_log (std::initializer_list< const char * > tags) | |
suppress_log (log_level min_level, std::initializer_list< const char * > tags) | |
void | suppress () |
void | restore () |
~suppress_log () | |
Move semantics | |
suppress_log (suppress_log const &)=delete | |
suppress_log (suppress_log &&other) noexcept | |
suppress_log & | operator= (suppress_log const &other)=delete |
suppress_log & | operator= (suppress_log &&other) noexcept |
Public Attributes | |
std::vector< std::pair< const char *, log_level > > | tag_log_lev {} |
log_level | min_level = log_level::none |
bool | is_suppressed = false |
A utility class to contextually enable/disable some of ESP32 log levels. This class is RAII, so it will restore the original logging level when destroyed.
|
default |
Default-constructor, does nothing.
mlab::suppress_log::suppress_log | ( | std::initializer_list< const char * > | tags | ) |
Suppresses instantly and entirely all the specified tags
tags | List of log tags, e.g. {"DESFIRE", "PN532"} . |
mlab::suppress_log::suppress_log | ( | log_level | min_level, |
std::initializer_list< const char * > | tags ) |
Suppresses all the specified tags
, allowing only logging at min_level
and above.
min_level | Minimum level that is echoed. |
tags | List of log tags, e.g. {"DESFIRE", "PN532"} . |
|
delete |
|
noexcept |
mlab::suppress_log::~suppress_log | ( | ) |
Calls restore before exiting.
|
noexcept |
|
delete |
void mlab::suppress_log::restore | ( | ) |
Manually restores all teh tags in tag_log_lev to the level they had at the constrution of the object.
void mlab::suppress_log::suppress | ( | ) |
Manually suppresses all the tags in tag_log_lev to the minimum echoed level min_level.
bool mlab::suppress_log::is_suppressed = false |
A boolean representing whether the suppression is active at the current moment in time.
log_level mlab::suppress_log::min_level = log_level::none |
The minimum level that is echoed.
std::vector<std::pair<const char *, log_level> > mlab::suppress_log::tag_log_lev {} |
A list of the log tags and their original log level.