Program Listing for File utils.hpp

Return to documentation for file (libspookyaction/include/desfire/esp32/utils.hpp)

//
// Created by spak on 1/10/23.
//

#ifndef DESFIRE_ESP32_UTILS_HPP
#define DESFIRE_ESP32_UTILS_HPP

#include <esp_log.h>
#include <initializer_list>
#include <vector>

namespace desfire::esp32 {
    struct suppress_log {
        std::vector<std::pair<const char *, esp_log_level_t>> tag_log_lev{};

        esp_log_level_t min_level = ESP_LOG_NONE;

        bool is_suppressed = false;

        suppress_log() = default;

        suppress_log(std::initializer_list<const char *> tags);

        suppress_log(esp_log_level_t min_level, std::initializer_list<const char *> tags);

        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;
        void suppress();

        void restore();

        ~suppress_log();
    };
}// namespace desfire::esp32

#endif//DESFIRE_ESP32_UTILS_HPP