Struct desfire::esp32::suppress_log
Defined in File utils.hpp
Struct Documentation
-
struct suppress_log
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.
Note
We can only reduce the log level, not increase it. Log levels that are not enabled at ESP32 configuration level are not available, as the statements are simply not compiled.
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 Functions
-
suppress_log() = default
Default-constructor, does nothing.
-
suppress_log(std::initializer_list<const char*> tags)
Suppresses instantly and entirely all the specified
tags
- Parameters:
tags – List of log tags, e.g.
{"DESFIRE", "PN532"}
.
-
suppress_log(esp_log_level_t min_level, std::initializer_list<const char*> tags)
Suppresses all the specified
tags
, allowing only logging atmin_level
and above.- Parameters:
min_level – Minimum level that is echoed.
tags – List of log tags, e.g.
{"DESFIRE", "PN532"}
.
-
void suppress()
Manually suppresses all the tags in tag_log_lev to the minimum echoed level min_level.
-
void restore()
Manually restores all teh tags in tag_log_lev to the level they had at the constrution of the object.
Public Members
-
std::vector<std::pair<const char*, esp_log_level_t>> tag_log_lev = {}
A list of the log tags and their original log level.
-
esp_log_level_t min_level = ESP_LOG_NONE
The minimum level that is echoed.
-
bool is_suppressed = false
A boolean representing whether the suppression is active at the current moment in time.
-
suppress_log(suppress_log const&) = delete