KDSPDSetup
Small library to initialize spdlog loggers from a toml configuration file.
details.cpp File Reference
#include "details.h"
Include dependency graph for details.cpp:

Go to the source code of this file.

Namespaces

 KDSPDSetup
 The only public-facing namespace in the library.
 
 KDSPDSetup::details
 This namespace contains implementation details and helpers used by functions in KDSPDSetup::setup. This includes lookup for sink types and spdlog enums, maps to contain named sinks, patterns, and thread pools (to be used when constructing loggers), and functions that actually construct sink pointers of specific types.
 

Functions

bool KDSPDSetup::details::inTypelist (std::string const &typeStr, std::vector< std::string > const &strList)
 Returns true if a string typeStr is present in a vector strList, and false if not. Used to identify a group to which a sink's type belongs when reading from a configuration file. This grouping informs what additional fields should be extracted and narrows down which constructors to call to create a sink. More...
 
auto KDSPDSetup::details::createRotatingFileSinkTuple (toml::table const &sinkTable, toml::string &&baseFilename, std::size_t const &maxFiles) -> std::tuple< toml::string const, std::size_t const, std::size_t const >
 Generates the argument list for rotating file sink constructor as a tuple and returns it. Given a TOML table representing a rotating file sink, a base filename, and a number of maximum files, extract and calculate the maximum file size from the table, and create a tuple with the base filename, max size, and max number of files in the correct order. Return this tuple so the values can be passed into the constructor for rotating file sink, in that order. More...
 
auto KDSPDSetup::details::createFileSinkTuple (toml::table const &sinkTable, bool const &truncate) -> std::tuple< toml::string const, bool const >
 Generates the argument list for basic file sink constructor as a tuple and returns it. Given a TOML table representing a basic file sink and a boolean value for truncate, extract the filename from the table, and create a tuple with the filename and truncate in the order in which they will be passed into the basic file sink constructor. Return this tuple. More...
 
auto KDSPDSetup::details::createDailyFileSinkTuple (toml::table &&sinkTable, bool const &truncate, toml::string &&baseFilename, uint16_t const &maxFiles) -> std::tuple< toml::string const, int const, int const, bool const, uint16_t const >
 Generates the argument list for daily file sink constructor as a tuple and returns it. Given a TOML table representing a basic file sink, a base filename, and a number of maximum files, and a boolean value for truncate, extract the rotation_hour and rotation_minute from the table, and create a tuple with the base filename, rotation hour, rotation minute, truncate, and maximum file count in the order in which they will be passed to the basic file sink constructor. Return this tuple. More...
 
auto KDSPDSetup::details::createNullSinkPtr () -> std::shared_ptr< spdlog::sinks::null_sink< spdlog::details::null_mutex >>
 Create a null sink shared pointer and return it. More...
 
auto KDSPDSetup::details::genFromFileStr (toml::string &&typeStr, toml::table &&sinkTable, bool const &truncate) -> spdlog::sink_ptr
 Return the result of calling KDSPDSetup::details::createFileSinkPtr with the correct template argument based on the value of typeStr. Uses macros createFileSinkStPtr and createFileSinkMtPtr for clarity. This function is called by KDSPDSetup::setup::handleTruncatableSink. More...
 
auto KDSPDSetup::details::genFromRotateStr (toml::string &&typeStr, toml::table &&sinkTable, toml::string &&baseFilename, std::size_t const &maxFiles) -> spdlog::sink_ptr
 Return the result of calling KDSPDSetup::details::createRotatingFileSinkPtr with the correct template argument based on the value of typeStr. Uses macros createRotatingFileSinkStPtr and createRotatingFileSinkMtPtr for clarity. This function is called by KDSPDSetup::setup::handleMultipleFileSink. More...
 
auto KDSPDSetup::details::genFromDailyStr (toml::string &&typeStr, toml::table &&sinkTable, bool const &truncate, toml::string &&baseFilename, uint16_t const &maxFiles) -> spdlog::sink_ptr
 Return the result of calling KDSPDSetup::details::createDailyFileSinkPtr with the correct template argument based on the value of typeStr. Uses macros createDailyFileSinkStPtr and createDailyFileSinkMtPtr for clarity. This function is called by KDSPDSetup::setup::handleMultipleFileSink. More...
 
auto KDSPDSetup::details::genFromNullOrStdStr (toml::string &&typeStr) -> spdlog::sink_ptr
 Return the result of calling KDSPDSetup::details::createStdoutSinkPtr with the correct template argument or KDSPDSetup::details::createNullSinkPtr, based on the value of typeStr. Uses macros createStdoutSinkStPtr and createStdoutSinkMtPtr for clarity. This function is called by KDSPDSetup::setup::setupSink. More...