This commit is contained in:
CupWater
2026-08-17 13:45:18 +08:00
parent 7eb3331d8e
commit 99404f62d0
3 changed files with 16 additions and 13 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
#include <chrono>
#include <string_view>
#include "log_level.hpp"
#include <featherlog/log_level.hpp>
namespace flog
{
+8 -7
View File
@@ -3,24 +3,25 @@
#include <memory>
#include "log_formatter.hpp"
#include "log_message.hpp"
#include <featherlog/log_formatter.hpp>
#include <featherlog/log_message.hpp>
#include <featherlog/flog_definitions.h>
namespace flog
{
class LogOutputter
class FLOG_API LogOutputter
{
public:
virtual ~LogOutputter() = default;
std::unique_ptr<LogFormatter> set_formatter(const std::unique_ptr<LogFormatter>& formatter);
std::unique_ptr<LogFormatter>& get_formatter();
std::unique_ptr<LogFormatter> FLOG_CALL set_formatter(const std::unique_ptr<LogFormatter>& formatter);
[[nodiscard]] const std::unique_ptr<LogFormatter>& FLOG_CALL get_formatter() const;
virtual void write(const LogMessage& message) = 0;
virtual void FLOG_CALL write(const LogMessage& message) = 0;
protected:
std::unique_ptr<LogFormatter> m_logFormatter;
};
}
#endif
#endif
+7 -5
View File
@@ -3,14 +3,15 @@
#include <format>
#include <source_location>
#include <utility>
#include "log_manager.hpp"
#include <featherlog/flog_definitions.h>
namespace flog
{
class LoggerCallback;
class LoggerManager;
class Logger
class FLOG_API Logger
{
friend class LogManager;
@@ -18,11 +19,12 @@ namespace flog
~Logger() = default;
template <typename... Args>
void info(std::format_string<Args...> fmt, Args&&... args,
void FLOG_CALL info(std::format_string<Args...> fmt, Args&&... args,
std::source_location loc = std::source_location::current());
private:
Logger(const std::string& name, std::weak_ptr<LogManager> manager) : m_name(name), m_logManager(manager)
Logger(std::string name, const std::weak_ptr<LogManager> &manager) noexcept :
m_name(std::move(name)), m_logManager(manager)
{ }
std::string m_name;