/* * Copyright (C) 2023 Christopher J. Howard * * This file is part of Antkeeper source code. * * Antkeeper source code is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Antkeeper source code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Antkeeper source code. If not, see . */ #ifndef ANTKEEPER_DEBUG_LOGGER_HPP #define ANTKEEPER_DEBUG_LOGGER_HPP #include #include #include #include #include namespace debug { /// @name Debug logging /// @{ /** * Generates an event each time a message logged. */ class logger { public: /** * Logs a message. * * @param message Message contents. * @param severity Message severity. * @param location Source location from which the message was sent. */ void log ( std::string&& message, log_message_severity severity = log_message_severity::info, std::source_location&& location = std::source_location::current() ); /// Returns the channel through which message logged events are published. [[nodiscard]] inline ::event::channel& get_message_logged_channel() noexcept { return m_message_logged_publisher.channel(); } private: ::event::publisher m_message_logged_publisher; }; /// @} } // namespace debug #endif // ANTKEEPER_DEBUG_LOGGER_HPP