VoidLoader/VoidLoaderCore/pipeline/head There was a failure building this commit
Signed-off-by: Faumaray <faumaray@gmail.com>
30 lines
1.0 KiB
C++
30 lines
1.0 KiB
C++
#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
|