Signed-off-by: Faumaray <faumaray@gmail.com>
This commit is contained in:
19 files changed
+579
-10
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user