22#include "util/SourceLocation.hpp"
45struct BenchmarkLoggingInitializer;
50class ClioConfigDefinition;
58#ifndef COVERAGE_ENABLED
60 if (auto clio_pump__ = x; not clio_pump__) { \
88 std::shared_ptr<spdlog::logger> logger_;
91 friend struct ::BenchmarkLoggingInitializer;
97 std::shared_ptr<spdlog::logger> logger_;
100 std::ostringstream stream_;
108 Pump(Pump&&) =
delete;
109 Pump(Pump
const&) =
delete;
111 operator=(Pump
const&) =
delete;
113 operator=(Pump&&) =
delete;
122 template <
typename T>
123 [[maybe_unused]] Pump&
127 stream_ << std::forward<T>(
data);
134 operator bool()
const
141 static constexpr std::array<char const*, 8> kCHANNELS = {
161 Logger(std::string channel);
168 operator=(
Logger const&) =
default;
171 operator=(
Logger&&) =
default;
228 Logger(std::shared_ptr<spdlog::logger> logger);
241 std::vector<std::shared_ptr<spdlog::sinks::sink>> allSinks;
249 static std::shared_ptr<spdlog::logger>
250 registerLogger(std::string
const& channel,
Severity severity =
data.defaultSeverity);
261 [[nodiscard]]
static std::expected<void, std::string>
276 [[nodiscard]]
static Logger::Pump
285 [[nodiscard]]
static Logger::Pump
294 [[nodiscard]]
static Logger::Pump
303 [[nodiscard]]
static Logger::Pump
312 [[nodiscard]]
static Logger::Pump
321 [[nodiscard]]
static Logger::Pump
329 [[nodiscard]]
static bool
333 struct FileLoggingParams {
336 uint32_t rotationSizeMB;
337 uint32_t dirMaxFiles;
340 friend struct ::BenchmarkLoggingInitializer;
343 static std::shared_ptr<spdlog::sinks::sink>
344 createFileSink(FileLoggingParams
const& params, std::string
const& format);
A global logging service.
Definition Logger.hpp:237
static Logger::Pump error(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::ERR severity.
Definition Logger.cpp:351
static Logger::Pump debug(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::DBG severity.
Definition Logger.cpp:333
static Logger::Pump warn(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::WRN severity.
Definition Logger.cpp:345
static void shutdown()
Shutdown spdlog to guarantee output is not lost.
Definition Logger.cpp:321
static std::expected< void, std::string > init(config::ClioConfigDefinition const &config)
Global log core initialization from a config::ClioConfigDefinition.
Definition Logger.cpp:266
static Logger::Pump fatal(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::FTL severity.
Definition Logger.cpp:357
static bool enabled()
Whether the LogService is enabled or not.
Definition Logger.cpp:363
static Logger::Pump trace(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::TRC severity.
Definition Logger.cpp:327
static Logger::Pump info(SourceLocationType const &loc=CURRENT_SRC_LOCATION)
Globally accessible General logger at Severity::NFO severity.
Definition Logger.cpp:339
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:87
Logger(std::string channel)
Construct a new Logger object that produces loglines for the specified channel.
Definition Logger.cpp:368
Pump warn(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::WRN severity.
Definition Logger.cpp:409
Pump error(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::ERR severity.
Definition Logger.cpp:414
Pump fatal(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::FTL severity.
Definition Logger.cpp:419
Pump debug(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::DBG severity.
Definition Logger.cpp:399
Pump trace(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::TRC severity.
Definition Logger.cpp:394
Pump info(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::NFO severity.
Definition Logger.cpp:404
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:50
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:70