KDSPDSetup
Small library to initialize spdlog loggers from a toml configuration file.
|
This class contains maps that associate string names to sink pointers, format strings, and thread pool information. This enables simple access of these objects by name when constructing loggers. There are no instances of the class - it is composed entirely of static members. More...
#include <details.h>
Static Public Member Functions | |
static auto | sinkMap () -> std::map< toml::string, spdlog::sink_ptr > const & |
Getter method for the private member KDSPDSetup::details::SPDMaps::mSinkMap. Used to index the map and obtain a sink pointer by name when constructing loggers. | |
static auto | patternMap () -> std::map< toml::string, toml::string > const & |
Getter method for the private member KDSPDSetup::details::SPDMaps::mPatternMap. Used to index the map and obtain a format string by name, to pass into spdlog::set_pattern when constructing sinks or loggers. | |
static auto | threadPoolMap () -> std::map< toml::string, std::pair< std::size_t, std::size_t > > const & |
Getter method for the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. Used to index the map by thread pool name when constructing asynchronous loggers, to obtain a pair containing queue size and thread count. | |
static void | emplaceSinkMap (std::pair< toml::string, spdlog::sink_ptr > &&_pr) |
Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called after a sink pointer is created in KDSPDSetup::setup::setupSink, to make it accessible by name when constructing loggers that will use it. | |
static void | emplacePatternMap (std::pair< toml::string, toml::string > &&_pr) |
Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called by KDSPDSetup::setup::setupPatterns when reading a pattern table from a configuration file. The pattern string is associated with its name so it can be accessed by name when constructing sinks or loggers that will use the string to format messages. | |
static void | emplaceThreadPoolMap (std::pair< toml::string, std::pair< std::size_t, std::size_t > > &&_pr) |
Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. This function is called by KDSPDSetup::setup::setupThreadPools when reading a thread_pool table from a configuration file. The thread pool's name is associated with its corresponding queue size and thread count, so they can be used later to construct asynchronous loggers. | |
Static Private Attributes | |
static std::map< toml::string, spdlog::sink_ptr > | mSinkMap {} |
Map that associates string names to sink pointers. When sink pointers are created from sink tables in a configuration file, they are added here. Then they can be specified by name and looked up from the map when constructing loggers. | |
static std::map< toml::string, toml::string > | mPatternMap {} |
Map that associates string names to pattern strings. When pattern tables are read from a configuration file, they are added here. Then they can be specified by name and looked up from the map when constructing loggers and sinks. | |
static std::map< toml::string, std::pair< std::size_t, std::size_t > > | mThreadPoolMap {} |
Map that associates string names to pairs of thread pool fields. The pairs represent the queue size and thread count of the thread pool, respectively. When thread_pool tables are read from a configuration file, their associated fields are added here. Then they can be specified by name, and their corresponding queue size and thread count can be looked up from the map when constructing asynchronous loggers. | |
This class contains maps that associate string names to sink pointers, format strings, and thread pool information. This enables simple access of these objects by name when constructing loggers. There are no instances of the class - it is composed entirely of static members.
|
static |
Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called by KDSPDSetup::setup::setupPatterns when reading a pattern
table from a configuration file. The pattern string is associated with its name so it can be accessed by name when constructing sinks or loggers that will use the string to format messages.
_pr | An rvalue reference pair containing name and pattern string, to be emplaced in KDSPDSetup::details::SPDMaps::mPatternMap. |
Definition at line 30 of file details.cpp.
|
static |
Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called after a sink pointer is created in KDSPDSetup::setup::setupSink, to make it accessible by name when constructing loggers that will use it.
_pr | An rvalue reference pair containing name and a sink pointer, to be emplaced in KDSPDSetup::details::SPDMaps::mSinkMap. |
Definition at line 26 of file details.cpp.
|
static |
Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. This function is called by KDSPDSetup::setup::setupThreadPools when reading a thread_pool
table from a configuration file. The thread pool's name is associated with its corresponding queue size and thread count, so they can be used later to construct asynchronous loggers.
_pr | An rvalue reference pair containing name and a nested pair containing a queue size and thread count, to be emplaced in KDSPDSetup::details::SPDMaps::mThreadPoolMap. |
Definition at line 34 of file details.cpp.
|
static |
Getter method for the private member KDSPDSetup::details::SPDMaps::mPatternMap. Used to index the map and obtain a format string by name, to pass into spdlog::set_pattern
when constructing sinks or loggers.
const
reference to the private data member KDSPDSetup::details::SPDMaps::mPatternMap. Definition at line 18 of file details.cpp.
|
static |
Getter method for the private member KDSPDSetup::details::SPDMaps::mSinkMap. Used to index the map and obtain a sink pointer by name when constructing loggers.
const
reference to the private data member KDSPDSetup::details::SPDMaps::mSinkMap. Definition at line 14 of file details.cpp.
|
static |
Getter method for the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. Used to index the map by thread pool name when constructing asynchronous loggers, to obtain a pair containing queue size and thread count.
const
reference to the private data member KDSPDSetup::details::SPDMaps::mThreadPoolMap. Definition at line 22 of file details.cpp.
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlinestaticprivate |
Map that associates string names to pairs of thread pool fields. The pairs represent the queue size and thread count of the thread pool, respectively. When thread_pool
tables are read from a configuration file, their associated fields are added here. Then they can be specified by name, and their corresponding queue size and thread count can be looked up from the map when constructing asynchronous loggers.
Definition at line 219 of file details.h.