22#include "util/SourceLocation.hpp"
46struct BenchmarkLoggingInitializer;
51class ClioConfigDefinition;
59#ifndef COVERAGE_ENABLED
61 if (auto clio_pump__ = x; not clio_pump__) { \
89 std::shared_ptr<spdlog::logger> logger_;
92 friend struct ::BenchmarkLoggingInitializer;
98 std::shared_ptr<spdlog::logger> logger_;
101 std::ostringstream stream_;
109 Pump(Pump&&) =
delete;
110 Pump(Pump
const&) =
delete;
112 operator=(Pump
const&) =
delete;
114 operator=(Pump&&) =
delete;
123 template <
typename T>
124 [[maybe_unused]] Pump&
128 stream_ << std::forward<T>(
data);
135 operator bool()
const
141 [[nodiscard]]
static std::string_view
146 static constexpr std::array<char const*, 8> kCHANNELS = {
166 Logger(std::string channel);
173 operator=(
Logger const&) =
default;
176 operator=(
Logger&&) =
default;
233 Logger(std::shared_ptr<spdlog::logger> logger);
246 std::vector<std::shared_ptr<spdlog::sinks::sink>> allSinks;
254 static std::shared_ptr<spdlog::logger>
255 registerLogger(std::string
const& channel,
Severity severity =
data.severity);
266 [[nodiscard]]
static std::expected<void, std::string>
281 [[nodiscard]]
static Logger::Pump
290 [[nodiscard]]
static Logger::Pump
299 [[nodiscard]]
static Logger::Pump
308 [[nodiscard]]
static Logger::Pump
317 [[nodiscard]]
static Logger::Pump
326 [[nodiscard]]
static Logger::Pump
334 [[nodiscard]]
static bool
338 struct FileLoggingParams {
341 uint32_t rotationSizeMB;
342 uint32_t dirMaxFiles;
345 friend struct ::BenchmarkLoggingInitializer;
348 static std::shared_ptr<spdlog::sinks::sink>
349 createFileSink(FileLoggingParams
const& params);
A global logging service.
Definition Logger.hpp:242
static Logger::Pump error(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::ERR severity.
Definition Logger.cpp:310
static Logger::Pump debug(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::DBG severity.
Definition Logger.cpp:292
static Logger::Pump warn(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::WRN severity.
Definition Logger.cpp:304
static void shutdown()
Shutdown spdlog to guarantee output is not lost.
Definition Logger.cpp:280
static std::expected< void, std::string > init(config::ClioConfigDefinition const &config)
Global log core initialization from a config::ClioConfigDefinition.
Definition Logger.cpp:224
static Logger::Pump fatal(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::FTL severity.
Definition Logger.cpp:316
static bool enabled()
Whether the LogService is enabled or not.
Definition Logger.cpp:322
static Logger::Pump trace(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::TRC severity.
Definition Logger.cpp:286
static Logger::Pump info(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::NFO severity.
Definition Logger.cpp:298
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:88
Logger(std::string channel)
Construct a new Logger object that produces loglines for the specified channel.
Definition Logger.cpp:327
Pump warn(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::WRN severity.
Definition Logger.cpp:366
Pump error(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::ERR severity.
Definition Logger.cpp:371
Pump fatal(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::FTL severity.
Definition Logger.cpp:376
Pump debug(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::DBG severity.
Definition Logger.cpp:356
Pump trace(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::TRC severity.
Definition Logger.cpp:351
Pump info(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::NFO severity.
Definition Logger.cpp:361
A class representing the source location of the current code.
Definition SourceLocation.hpp:52
All the config data will be stored and extracted from this class.
Definition ConfigDefinition.hpp:54
This namespace implements the data access layer and related components.
Definition AmendmentCenter.cpp:70
This namespace contains various utilities.
Definition AccountUtils.hpp:30
Severity
Custom severity levels for util::Logger.
Definition Logger.hpp:71