change in logger and initialization

Signed-off-by: Faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2025-10-20 21:06:41 +03:00
1 parent ee296351c6
commit 4cd8386ff4
2 files changed
+36 -2

No files matched your search

+3 -2
View File
@@ -13,6 +13,7 @@ struct Logger : public std::enable_shared_from_this<Logger> {
virtual std::string_view prefix() const noexcept = 0;
virtual void setLevel(Level) noexcept = 0;
virtual void setMaxBytes(std::uintmax_t) noexcept = 0;
virtual Level level() const noexcept = 0;
template <class... Args>
@@ -21,8 +22,8 @@ struct Logger : public std::enable_shared_from_this<Logger> {
Message m;
m.ts = std::chrono::system_clock::now();
m.level = lvl;
m.prefix = std::string(prefix());
m.text = std::vformat(fmt.get(), std::make_format_args(std::forward<Args>(args)...));
m.prefix = "[" + std::string(prefix()) + "]";
m.text = std::format(fmt, std::forward<Args>(args)...);
enqueue(std::move(m));
}