// SPDX-FileCopyrightText: Matteo Settenvini // SPDX-License-Identifier: GPL-3.0-or-later #pragma once #include #include #include namespace malcontent { class Logger { friend std::unique_ptr std::make_unique(); friend std::default_delete; public: static auto debug(const std::string_view& msg) -> void; static auto info(const std::string_view& msg) -> void; static auto warn(const std::string_view& msg) -> void; static auto error(const std::string_view& msg) -> void; private: Logger(); Logger(const Logger&) = delete; Logger(Logger&&) = delete; ~Logger() noexcept; auto operator=(const Logger&) = delete; auto operator=(Logger&&) = delete; auto log(int priority, std::string_view msg) -> void; int _max_log_priority; static auto instance() -> Logger&; static std::unique_ptr _instance; static std::shared_mutex _instance_mtx; }; } // ~ namespace malcontent