23#include <source_location>
82 [[nodiscard]] std::string_view
FileNameOnly(std::string_view path);
102 void AddSink(std::unique_ptr<LogSink> sink);
110 void Write(
Channel channel,
Level level, std::string_view message,
const std::source_location& location);
115 std::vector<std::unique_ptr<LogSink>>
m_sinks;
128 template <
typename... Args>
130 std::format_string<Args...>
text;
133 template <
typename Text>
134 requires std::convertible_to<const Text&, std::string_view>
135 consteval FormatWithLocation(
const Text& pattern, std::source_location where = std::source_location::current())
139 template <
typename... Args>
146 logger.
Write(channel, level, std::format(pattern.text, std::forward<Args>(args)...), pattern.location);
virtual void Write(const LogRecord &record)=0
virtual ~LogSink()=default
bool IsEnabled(Level level) const
void AddSink(std::unique_ptr< LogSink > sink)
void SetMinLevel(Level level)
void Write(Channel channel, Level level, std::string_view message, const std::source_location &location)
chr::steady_clock::time_point m_startTime
std::atomic< Level > m_minLevel
std::vector< std::unique_ptr< LogSink > > m_sinks
Logger(const Logger &)=delete
Logger & operator=(const Logger &)=delete
char LevelLetter(Level level)
std::string_view ChannelName(Channel channel)
std::string_view FileNameOnly(std::string_view path)
std::string FormatLogLine(const LogRecord &record, bool withLocation)
void Log(Channel channel, Level level, FormatWithLocation< std::type_identity_t< Args >... > pattern, Args &&... args)
std::string_view LevelName(Level level)
bool ParseLevel(std::string_view text, Level &level)
std::source_location location