KDSPDSetup
Small library to initialize spdlog loggers from a toml configuration file.
Loading...
Searching...
No Matches
setup.h
Go to the documentation of this file.
1/*
2 This file is part of KDSpdSetup.
3
4 SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5
6 SPDX-License-Identifier: MIT
7
8 Contact KDAB at <info@kdab.com> for commercial licensing options.
9*/
10#pragma once
11
12#include "details.h"
13
22namespace KDSPDSetup::setup {
23
38void handleMultipleFileSink(toml::string &&typeStr, toml::table &&sinkTable, spdlog::sink_ptr &sinkPtr, bool const &truncate);
39
52void handleTruncatableSink(toml::string &&typeStr, toml::table &&sinkTable, spdlog::sink_ptr &sinkPtr);
53
64void setupSink(toml::table &&sinkTable);
65
74void setupSinks(toml::value const &data);
75
87void setupPatterns(toml::value const &data);
88
99void setupThreadPools(toml::value const &data);
100
118void registerAsynchronousLogger(toml::table const &loggerTable, toml::string const &name, std::vector<spdlog::sink_ptr> const &sinkList,
119 toml::string const &pattern);
120
134void registerSynchronousLogger(toml::table const &loggerTable, toml::string const &name, std::vector<spdlog::sink_ptr> const &sinkList,
135 toml::string const &pattern);
136
148void setupLogger(toml::table const &loggerTable);
149
157void setupLoggers(toml::value const &data);
158
159} // namespace KDSPDSetup::setup
This namespace contains the functions directly called by KDSPDSetup::setupFrom, along with helpers ca...
Definition setup.cpp:16
void setupLoggers(toml::value const &data)
Using data read from a toml file, extract vector of tables representing every logger specified....
Definition setup.cpp:243
void setupPatterns(toml::value const &data)
Using data read from a toml file, search for the key global_pattern. If it exists,...
Definition setup.cpp:108
void setupLogger(toml::table const &loggerTable)
Given a table representation of a logger whose name is not already registered with spdlog,...
Definition setup.cpp:205
void setupSink(toml::table &&sinkTable)
Given a table representation of a sink, creates an spdlog::sink_ptr, and evaluates the type of sink s...
Definition setup.cpp:43
void registerSynchronousLogger(toml::table const &loggerTable, toml::string const &name, std::vector< spdlog::sink_ptr > const &sinkList, toml::string const &pattern)
Creates an std::shared_ptr<spdlog::logger> initialized with name and the sink pointers in sinklist,...
Definition setup.cpp:185
void handleMultipleFileSink(toml::string &&typeStr, toml::table &&sinkTable, spdlog::sink_ptr &sinkPtr, bool const &truncate)
Helper function for setting up sinks that use multiple files. The function extracts values for base_f...
Definition setup.cpp:18
void setupSinks(toml::value const &data)
Using data read from a toml file, extract vector of tables representing every sink specified....
Definition setup.cpp:99
void setupThreadPools(toml::value const &data)
Using data read from a toml file, search for a table global_thread_pool, and initialize it with the s...
Definition setup.cpp:127
void handleTruncatableSink(toml::string &&typeStr, toml::table &&sinkTable, spdlog::sink_ptr &sinkPtr)
Helper function for setting up file-based sinks that require a truncate argument in their constructor...
Definition setup.cpp:32
void registerAsynchronousLogger(toml::table const &loggerTable, toml::string const &name, std::vector< spdlog::sink_ptr > const &sinkList, toml::string const &pattern)
Creates an std::shared_ptr<spdlog::async_logger> initialized with name, the sink pointers in sinklist...
Definition setup.cpp:150