{"id":19430499,"url":"https://github.com/kdab/kdspdsetup","last_synced_at":"2025-09-08T11:14:37.597Z","repository":{"id":222859775,"uuid":"754200454","full_name":"KDAB/KDSPDSetup","owner":"KDAB","description":"A small library in modern C++ to initialize spdlog loggers from a toml configuration file.","archived":false,"fork":false,"pushed_at":"2025-05-05T14:04:59.000Z","size":198,"stargazers_count":16,"open_issues_count":4,"forks_count":4,"subscribers_count":35,"default_branch":"main","last_synced_at":"2025-08-20T23:41:42.006Z","etag":null,"topics":["cmake","config","cpp","cpp20","library","spdlog","toml-config"],"latest_commit_sha":null,"homepage":"https://docs.kdab.com/kdspdsetup/unstable/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KDAB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSES/MIT.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-07T15:41:55.000Z","updated_at":"2025-06-09T13:50:52.000Z","dependencies_parsed_at":"2025-04-24T18:38:40.901Z","dependency_job_id":"4842086a-e2fe-4766-a250-73564dec0e2f","html_url":"https://github.com/KDAB/KDSPDSetup","commit_stats":null,"previous_names":["kdab/kdspdsetup"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/KDAB/KDSPDSetup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2FKDSPDSetup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2FKDSPDSetup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2FKDSPDSetup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2FKDSPDSetup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KDAB","download_url":"https://codeload.github.com/KDAB/KDSPDSetup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KDAB%2FKDSPDSetup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274174271,"owners_count":25235203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmake","config","cpp","cpp20","library","spdlog","toml-config"],"created_at":"2024-11-10T14:25:19.466Z","updated_at":"2025-09-08T11:14:37.562Z","avatar_url":"https://github.com/KDAB.png","language":"C++","readme":"\u003c!--\nThis file is part of KDSpdSetup.\n\nSPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company \u003cinfo@kdab.com\u003e\n\nSPDX-License-Identifier: MIT\n\nContact KDAB at \u003cinfo@kdab.com\u003e for commercial licensing options.\n--\u003e\n\n# KDSPDSetup\n\n![MIT License](https://img.shields.io/badge/MIT_LICENSE-darkgreen?style=for-the-badge\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEiIHdpZHRoPSIyNSIgaGVpZ2h0PSIyNSI+PHBhdGggZD0iTTEyLjc1IDIuNzVWNC41aDEuOTc1Yy4zNTEgMCAuNjk0LjEwNi45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JjLjA1IDAgLjA5OS0uMDE1LjE0MS0uMDQzbDEuNjk1LTEuMTU0Yy4yOS0uMTk4LjYzNC0uMzAzLjk4NS0uMzAzaDEuOTc0VjIuNzVhLjc1Ljc1IDAgMCAxIDEuNSAwWk0yLjE5MyAxNS4xOThhNS40MTQgNS40MTQgMCAwIDAgMi41NTcuNjM1IDUuNDE0IDUuNDE0IDAgMCAwIDIuNTU3LS42MzVMNC43NSA5LjM2OFptMTQuNTEtLjAyNGMuMDgyLjA0LjE3NC4wODMuMjc1LjEyNi41My4yMjMgMS4zMDUuNDUgMi4yNzIuNDVhNS44NDcgNS44NDcgMCAwIDAgMi41NDctLjU3NkwxOS4yNSA5LjM2N1oiIGZpbGw9IiNmZmYiPjwvcGF0aD48L3N2Zz4=)![C++](https://img.shields.io/badge/c%2B%2B-red?style=for-the-badge\u0026logo=c%2B%2B)![CMake](https://img.shields.io/badge/CMake-%23008FBA.svg?style=for-the-badge\u0026logo=cmake\u0026logoColor=white)![Git](https://img.shields.io/badge/git-%23F05033.svg?style=for-the-badge\u0026logo=git\u0026logoColor=white)![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge\u0026logo=linux\u0026logoColor=black)![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge\u0026logo=windows\u0026logoColor=white)![macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge\u0026logo=macos\u0026logoColor=F0F0F0)\n\n## Overview\n\nKDSPDSetup is a minimal reimplementation of the unmaintained [spdlog_setup](https://github.com/guangie88/spdlog_setup) library for modern C++ projects.\n\nComplete documentation is available [here](https://kdab.github.io/KDSPDSetup).\n\nGiven a TOML file containing configuration parameters, `spdlog` loggers for your project can be set up with a single call to `KDSPDSetup::setupFrom`, as shown below:\n\n```cpp\n#include \u003cKDSpdSetup/kdspdsetup.h\u003e\n\nint main()\n{\n    KDSPDSetup::setupFrom(\"example.toml\");\n\n    auto logger = spdlog::get(\"root\");\n    logger-\u003edebug(\"Hello spdlog!\");\n}\n\n// [2023-10-30 14:35:19.244] [root] [debug] Hello spdlog!\n\n```\n\nThe configuration file for this example, `example.toml`, might look like this:\n\n```c\n[[sink]]\nname = \"console_st\"\ntype = \"stdout_sink_st\"\n\n[[logger]]\nname = \"root\"\nsinks = [\"console_st\"]\nlevel = \"debug\"\n```\n\n## Requirements\n\nYou will need a compiler that supports the C++20 standard.\n\nOur CI has successfully built and tested on these environments:\n|Platform|Kernel|Arch|Compiler|Compiler Version\n|-|-|-|-|-\n| Windows 10 | Microsoft Windows [Version 10.0.19044.1526] | x64 | MSVC | 19.34.31937.0\n| Ubuntu GNU/Linux | 4.15.0-167-generic #175-Ubuntu SMP | x64 | GCC | 11.4.0\n| MacOS | Darwin Kernel Version 22.6.0 xnu-8796.141.3.701.17 | arm64 | clang | 14.0.3.14030022\n\nThe following compiler versions should be sufficient, but this has not been fully tested:\n\n| ![GNU Badge](https://img.shields.io/badge/gcc-A42E2B?logo=gnu\u0026logoColor=fff\u0026style=for-the-badge) | ![LLVM Badge](https://img.shields.io/badge/clang-262D3A?logo=llvm\u0026logoColor=fff\u0026style=for-the-badge) | ![Visual Studio Badge](https://img.shields.io/badge/msvc-5C2D91?logo=visualstudio\u0026logoColor=fff\u0026style=for-the-badge) | ![NVIDIA Badge](https://img.shields.io/badge/nvcc-76B900?logo=nvidia\u0026logoColor=fff\u0026style=for-the-badge) | ![Intel Badge](https://img.shields.io/badge/Intel%20C++-0071C5?logo=intel\u0026logoColor=fff\u0026style=for-the-badge)\n|-|-|-|-|-\n| GCC 10+ | Clang 8+ | MSVC 19.22+ | NVCC 12.0+ | Intel C++ 2021.1+\n\nIf any [dependencies](#dependencies) are not found, CMake's FetchContent will use [`git`](https://git-scm.com/) to retrieve them. Thus, `git` is also a requirement in this case.\n\n## Dependencies\n\nAside from [spdlog](https://github.com/gabime/spdlog), there are three additional dependencies:\n\n| Purpose       | Lib                                           | Needed\n| ------------- | --------------------------------------------- | ----------\n| TOML parsing  | [toml11](https://github.com/ToruNiina/toml11) | Always\n| Testing       | [doctest](https://github.com/doctest/doctest) | Tests only\n| Documentation | [doxygen](https://github.com/doxygen/doxygen) | Documentation only\n\nThese dependencies will be automatically downloaded with `git` if not found.\n\n## Build \u0026 Install\n\n### Build\n\nYou'll need at least CMake 3.11 to build this library.\n\nYou can skip to the [CMake Presets](#cmake-presets) section if you'd like to use a preset that will set the source and build directories for you, along with some flags.\n\nTo configure and build, use the following `cmake` commands:\n\n```bash\n$ cmake -S \u003csource-dir\u003e -B \u003cbuild-dir\u003e \u003cflags\u003e\n$ cmake --build \u003cbuild-dir\u003e\n```\n\nwhere `\u003csource-dir\u003e` is the root directory of this project and `\u003cbuild-dir\u003e` is the desired build directory.\n\n`\u003cflags\u003e` can be empty or contain one or more of the flags detailed in the [Tests](#tests), [Examples](#examples), and [Documentation](#documentation) sections below.\n\nFor example, from this directory one might run the following:\n\n```bash\n$ cmake -S . -B build\n$ cmake --build build\n```\n\nwhich creates the directory `build` if it does not exist, configures CMake, and builds the project.\n\n### CMake Presets\n\nThere are a number of CMake presets included. These will configure a build with specific flags set for either development or release.\n\n`dev-*` configurations will add tests and documentation to the build targets. They also build in CMake's `Debug` mode, which will enable debug symbols and will NOT use compiler optimization flags.\n\n`release-*` configurations will not build tests or documentation. They build in CMake's `Release` mode, which will use compiler optimization and will NOT build with debug symbols.\n\nExamples will be built with both types of preset unless explicitly disabled with [`-DKDSPDSETUP_BUILD_EXAMPLES=OFF`](#examples).\n\nHere are all the presets:\n\n- `dev-gcc`\n- `dev-clang`\n- `dev-msvc`\n- `release-gcc`\n- `release-clang`\n- `release-msvc`\n\nTo build from this directory with a preset (we'll use `dev-gcc` as an example), one would run the following:\n\n```bash\n$ cmake --preset dev-gcc\n$ cmake --build build-dev-gcc\n```\n\nNote that for preset name `presetName` the build directory will be titled `build-presetName`.\n\n### Install\n\nTo install the library on your system, after completing the steps in the [Build](#build) section above, run the following command:\n\n```bash\n$ sudo cmake --install \u003cbuild-dir\u003e\n```\n\n### Tests\n\nYou can build the unit tests by passing the flag `-DKDSPDSETUP_BUILD_TESTS=ON` to CMake:\n\n```bash\n$ cmake -S \u003csource-dir\u003e -B \u003cbuild-dir\u003e -DKDSPDSETUP_BUILD_TESTS\n$ cmake --build \u003cbuild-dir\u003e\n```\n\nThe dependency [doctest](https://github.com/doctest/doctest) will only be used when this flag is on.\n\n### Examples\n\nBuilding examples is on by default.\n\nTo disable the basic examples, pass the flag `-DKDSPDSETUP_BUILD_EXAMPLES=OFF` to CMake:\n\n```bash\n$ cmake -S \u003csource-dir\u003e -B \u003cbuild-dir\u003e -DKDSPDSETUP_BUILD_EXAMPLES=OFF\n$ cmake --build \u003cbuild-dir\u003e\n```\n\n### Documentation\n\nThe documentation for this project [is available online](https://kdab.github.io/KDSPDSetup).\n\nTo build the documentation locally, pass the flag `-DKDSPDSETUP_BUILD_DOCS=ON` to CMake.\n\n```bash\n$ cmake -S \u003csource-dir\u003e -B \u003cbuild-dir\u003e -DKDSPDSETUP_BUILD_DOCS\n$ cmake --build \u003cbuild-dir\u003e\n```\n\nThe dependency [doxygen](https://github.com/doxygen/doxygen) will only be used when this flag is on.\n\n## Usage\n\n### Use With CMake Project\n\nTo use the library in a CMake project, make sure to [install](#install) the library.\n\nThen, simply write the following line in your `CMakeLists.txt`:\n\n```cmake\nfind_package(KDSpdSetup)\n```\n\nand after adding your target, let's call it `untitled`, link with this CMake command:\n\n```cmake\ntarget_link_libraries(untitled KDSpdSetup::KDSpdSetup)\n```\n\n### Configuration\n\nWriting configuration files that can be used by KDSPDSetup is simple.\n\n#### Sinks\n\nTo configure a sink, a name and sink type must be provided:\n\n```c\n[[sink]]\nname = \"some_name\"\ntype = \"stdout_sink_st\"\n```\n\nOptionally, a level can also be specified:\n\n```c\n[[sink]]\nname = \"stdout_error\"\ntype = \"stdout_sink_mt\"\nlevel = \"err\"\n```\n\nSome sink types require additional fields, or allow additional optional fields.\n\nThe list below details the sink types which have additional required fields:\n\n|`type`|required field|value type\n|-|-|-\n|`basic_file_sink_st`\u003cbr\u003e`basic_file_sink_mt` |`filename`|`string`\n|`rotating_file_sink_st`\u003cbr\u003e`rotating_file_sink_mt`|`base_filename`\u003cbr\u003e`max_size`\u003cbr\u003e`max_files`|`string`\u003cbr\u003e`string`\u003cbr\u003e`int`\n|`daily_file_sink_st`\u003cbr\u003e`daily_file_sink_mt`|`base_filename`\u003cbr\u003e`rotation_hour`\u003cbr\u003e`rotation_minute`|`string`\u003cbr\u003e`int`\u003cbr\u003e`int`\n\nAll of the above sink types can also optionally specify the boolean `truncate`, which defaults to `false` if not specified.\n\nThe syslog sink types, `syslog_sink_st` and `syslog_sink_mt`, have four optional fields that generally do not need to be filled (but can be if needed):\n|key name|value type|default value\n|-|-|-\n|`ident`|`string`|`\"\"`\n|`syslog_option`|`int`|`0`\n|`syslog_facility`|`int`|`1`\n\nNote that a `syslog_facility` value of `1` is the plain integer value for `LOG_USER`.\n\nHere is a full list of currently supported sink types and the platforms on which they are available:\n\n|Sink Type|Platform(s)\n|-|-\n|`stdout_sink_st`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`stdout_sink_mt`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`color_stdout_sink_st`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvb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MEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`basic_file_sink_st`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`basic_file_sink_mt`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHB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IDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`rotating_file_sink_mt`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`daily_file_sink_st`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`daily_file_sink_mt`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`null_sink_st`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`null_sink_mt`|![All](https://img.shields.io/badge/all-darkgreen?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYiIHdpZHRoPSIxNCIgdmlld0JveD0iMCAwIDQ0OCA1MTIiPjwhLS0hRm9udCBBd2Vzb21lIEZyZWUgNi41LjEgYnkgQGZvbnRhd2Vzb21lIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20gTGljZW5zZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tL2xpY2Vuc2UvZnJlZSBDb3B5cmlnaHQgMjAyMyBGb250aWNvbnMsIEluYy4tLT48cGF0aCBvcGFjaXR5PSIxIiBmaWxsPSJ3aGl0ZSIgZD0iTTQzOC42IDEwNS40YzEyLjUgMTIuNSAxMi41IDMyLjggMCA0NS4zbC0yNTYgMjU2Yy0xMi41IDEyLjUtMzIuOCAxMi41LTQ1LjMgMGwtMTI4LTEyOGMtMTIuNS0xMi41LTEyLjUtMzIuOCAwLTQ1LjNzMzIuOC0xMi41IDQ1LjMgMEwxNjAgMzM4LjcgMzkzLjQgMTA1LjRjMTIuNS0xMi41IDMyLjgtMTIuNSA0NS4zIDB6Ii8+PC9zdmc+\u0026style=for-the-badge)\n|`syslog_sink_st`|![Linux](https://img.shields.io/badge/Linux_Only-FCC624?style=for-the-badge\u0026logo=linux\u0026logoColor=black)\n|`syslog_sink_mt`|![Linux](https://img.shields.io/badge/Linux_Only-FCC624?style=for-the-badge\u0026logo=linux\u0026logoColor=black)\n|`msvc_sink_st`|![Windows](https://img.shields.io/badge/Windows_Only-0078D6?style=for-the-badge\u0026logo=windows\u0026logoColor=white)\n|`msvc_sink_mt`|![Windows](https://img.shields.io/badge/Windows_Only-0078D6?style=for-the-badge\u0026logo=windows\u0026logoColor=white)\n\nPlease note that the suffix `_st` refers to single thread, and `_mt` to multiple threads.\n\n#### Patterns\n\nThe global pattern is defined as a free-standing key-value pair (not under a `[[pattern]]` or any other table):\n\n```c\nglobal_pattern = \"[%Y-%m-%dT%T%z] [%L] \u003c%n\u003e: %v\"\n```\n\nIf `global_pattern` is not specified, the spdlog uses the default pattern `“[%Y-%m-%d %H:%M:%S. %e] [%l] [%n] %v”`.\n\nAdditionally, named patterns can be defined and reused with several different loggers:\n\n```c\n[[pattern]]\nname = \"short_pattern\"\nvalue = \"%c-%L: %v\"\n```\n\n#### Thread Pools\n\nAn async logger takes a thread pool as an argument to its constructor. This can be either a global thread pool, or a manually constructed one.\n\nThe global thread pool is defined as a table with single brackets (`[global_thread_pool]`, **not** `[[global_thread_pool]]`) because it is one table, not an array of tables. Named thread pools are members of the array of tables `[[threadpool]]`.\n\nBoth require integers `queue_size` and `num_threads`, while non-global thread pools also require a name.\n\n```c\n[global_thread_pool]\nqueue_size = 8192\nnum_threads = 1\n\n[[thread_pool]]\nname = \"tp\"\nqueue_size = 4096\nnum_threads = 2\n```\n\n#### Loggers\n\nLoggers require a name, and a list of sink names:\n\n```c\n[[logger]]\nname = \"my_logger\"\nsinks = [\"console_sink_st\", \"console_sink_mt\", \"file_out\", \"file_err\"]\n```\n\nPlease keep in mind that each sink name must be a `name` from a `[[sink]]` defined somewhere in the configuration file. If the name is not found, `std::out_of_range` will be thrown.\n\nLoggers can also optionally specify patterns and levels:\n\n```c\n[[logger]]\nname = \"root\"\nsinks = [\n    \"console_st\", \"console_mt\",\n    \"color_console_st\", \"color_console_mt\",\n    \"daily_out\", \"daily_err\",\n    \"file_out\", \"file_err\",\n    \"rotate_out\", \"rotate_err\",\n    \"null_sink_st\", \"null_sink_mt\",\n    \"syslog_st\", \"syslog_mt\"]\nlevel = \"trace\"\npattern = \"short_pattern\"\n```\n\nThe pattern name also must be defined somewhere in the configuration.\n\nAsynchronous loggers can be defined by specifying `type = \"async\"`:\n\n```c\n[[logger]]\ntype = \"async\"\nname = \"my_async\"\nsinks = [\"console_mt\"]\n```\n\nOptionally, async loggers can have a specified thread pool and overflow policy:\n\n```c\n[[logger]]\ntype = \"async\"\nname = \"local_async\"\nsinks = [\"console_mt\"]\npattern = \"succient\"\nthread_pool = \"tp\"\noverflow_policy = \"overrun_oldest\"\n```\n\nIf no thread pool is specified, the global thread pool is used.\n\nThe options for overflow policy are `\"block\"` and `\"overrun_oldest\"`. If not specified, `\"block\"` is used by default.\n\n#### Example Files\n\nThis repository contains a few example configuration files:\n\n- `examples/example.toml`\n- `tests/full/full-linux.toml`\n- `tests/full/full-linux.toml`\n- `tests/pre/pre.toml`\n\nHuge thanks to [guangie88](https://github.com/guangie88) for providing these examples in the original [spdlog_setup](https://github.com/guangie88/spdlog_setup) project. The files in that project are available under the terms of the [MIT](https://github.com/guangie88/spdlog_setup/blob/master/LICENSE) license.\n\n## Licensing\n\nKDSPDSetup is (C) 2023, Klarälvdalens Datakonsult AB, and is available under the terms of the [MIT](LICENSES/MIT.txt) license.\n\nContact KDAB at \u003cinfo@kdab.com\u003e if you need different licensing options.\n\n## About KDAB\n\nKDSPDSetup is supported and maintained by Klarälvdalens Datakonsult AB (KDAB).\n\nThe KDAB Group is the global No.1 software consultancy for Qt, C++ and OpenGL applications across desktop, embedded and mobile platforms.\n\nThe KDAB Group provides consulting and mentoring for developing Qt applications from scratch and in porting from all popular and legacy frameworks to Qt. We continue to help develop parts of Qt and are one of the major contributors to the Qt Project. We can give advanced or standard trainings anywhere around the globe on Qt as well as C++, OpenGL, 3D and more.\n\nPlease visit \u003chttps://www.kdab.com\u003e to meet the people who write code like this.\n\nStay up-to-date with KDAB product announcements:\n\n- [KDAB Newsletter](https://news.kdab.com)\n- [KDAB Blogs](https://www.kdab.com/category/blogs)\n- [KDAB on Twitter](https://twitter.com/KDABQt)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdab%2Fkdspdsetup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdab%2Fkdspdsetup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdab%2Fkdspdsetup/lists"}