Logger api
VoidLoader/VoidLoaderCore/pipeline/head There was a failure building this commit

Signed-off-by: Faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2025-10-19 23:18:07 +03:00
1 parent c9711dc5fd
commit de538e00b6
19 files changed
+579 -10

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <Logging/Provider.hpp>
#include <Logging/Sink.hpp>
#include <mutex>
#include <string>
#include <string_view>
#include <unordered_map>
namespace vl::logging {
class LoggerProvider final : public Provider {
public:
std::shared_ptr<Logger> createConsole(std::string prefix, Level lvl) override;
std::shared_ptr<Logger> createFile(std::string prefix, std::string basePath,
std::uintmax_t maxBytes, Level lvl) override;
std::shared_ptr<Logger> createCombined(std::string prefix, std::string basePath,
std::uintmax_t maxBytes, Level lvl) override;
std::shared_ptr<Logger> get(std::string_view prefix) const override;
bool exists(std::string_view prefix) const override;
private:
std::shared_ptr<Logger> emplaceOrGet_(std::string prefix, std::shared_ptr<Sink> sink, Level lvl);
mutable std::mutex mtx_;
std::unordered_map<std::string, std::shared_ptr<Logger>> byPrefix_;
};
} // namespace vl::log