Questions tagged [spdlog]

Very fast, header only, C++ logging library.

GitHub Project

Very fast, header only, C++ logging library.

118 questions
14
votes
1 answer

Adding header-only dependencies with CMake

I have a simple project which requires three header-only libraries in order to compile: websocketpp, spdlog and nlohmann/json. The project structure looks like this: └── src ├── app │   ├── CMakeLists.txt │   ├── src │   └── test …
arnaudoff
  • 686
  • 8
  • 20
14
votes
2 answers

Logging from library with spdlog

I am trying to use spdlog in a project involving a library under windows. I create two loggers. One for the app using the library, one for the library itself. The library's logger is created from the app but when the library want to add a message,…
AlexandreP
  • 410
  • 1
  • 5
  • 17
10
votes
3 answers

How to enable/disable spdlog logging in code?

I am creating c++ library modules in my application. To do logging, I use spdlog. But in a production environment, I don't want my lib modules to do any logging. One way to achieve turning on/off would be to litter my code with #ifdef…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
9
votes
2 answers

Extend spdlog for custom type

Is there a way to extend spdlog to support a custom struct as an item when formatting using {}? So when I have a struct p { int x; int y; int z; }; p my_p; I want to do spdlog::info("p = {}", my_p); // after registering some kind of…
pmf
  • 7,619
  • 4
  • 47
  • 77
8
votes
3 answers

cmake include header only library

I want to include spdlog into one of my project. It is a header only library. The project that i am building is using cmake. Currently i am using include_directories('src/logger/spdlog/') in cmake and including the library as #include…
xander cage
  • 219
  • 1
  • 4
  • 11
7
votes
1 answer

Function from one library matched to template from another library

I'm working on a C++ project that uses two different libraries: spdlog for logging, and mutils-serialization for serializing objects to bytes (for sending over the network). Both libraries use namespaces properly, but when I attempt to write a…
Edward
  • 5,942
  • 4
  • 38
  • 55
6
votes
3 answers

How to get the current spdlog level?

I need to turn off the spdlog level before some code then return it to the previous value after. How do I get the current level before turning it off?
Howaida Khoureieh
  • 519
  • 2
  • 11
  • 24
5
votes
1 answer

Linux C++ compilation error

I am trying to load images using stb_image.h but I am getting two compiler errors in the version of provided by gcc. I figure that there is probably a compiler option that is needed but I haven't been able to find what it is. Error…
Ceredia
  • 51
  • 4
4
votes
2 answers

Cannot format argument from within spdlog

I am trying to use spdlog. I incorporated it with my code, but now I am getting the following error: ....fmt\core.h(1016): error C2338: Cannot format argument. To make type T formattable provide a formatter specialization:…
CygnusX1
  • 20,968
  • 5
  • 65
  • 109
3
votes
0 answers

Is there a way to pause spdlog's logger (or a single sink)?

I am using spdlog's asynchronous logging. I create a console window and redirect stdout and stderr to it at a late point in the application. spdlog works fine after I have the window ready. But before that, I miss the logs. Basically, I have the…
sorush-r
  • 10,490
  • 17
  • 89
  • 173
3
votes
2 answers

spdlog: not configuring the logger correctly using same sink

The following code : #include "spdlog/spdlog.h" #include "spdlog/sinks/stdout_color_sinks.h" int main() { auto stdout_sink = std::make_shared(); auto a = std::make_shared("a", stdout_sink); …
ATK
  • 1,296
  • 10
  • 26
3
votes
1 answer

How do you reference a specific recipe revision from conan-index?

I need to reference spdlog 1.7.0 revision 1eebff2f51d90cb700b63c6d2449ebcb, not the latest revision, but I cannot seem to do this. Specifying revision requires the user/channel#REV syntax, but recipes on conan index doesn't seem to have…
apanloco
  • 175
  • 1
  • 8
3
votes
0 answers

Spdlog much slower than Boost Log

I recently switched from Boost Log to Spdlog for the purported speed advantages. However, when I compared the runtimes before and after the switch, I'm finding that Boost Log is significantly faster. I'm wondering if I'm doing something wrong with…
sheridp
  • 1,386
  • 1
  • 11
  • 24
3
votes
2 answers

How to declare static information in scopes accessible to nested lexical scopes in C++?

I want to declare identifiers for scopes which will be used to automatically populate a field of any logging statements within the innermost scope. They will usually, but not always (e.g. lambdas, blocks introduced with {}), match the "name" of the…
Chris Hunt
  • 3,840
  • 3
  • 30
  • 46
3
votes
1 answer

How to start and shutdown spdlog multiple times in the same program?

I'm using spdlog to run logs for both managed and unmanaged code in Visual Studio. For that reason I've written shell classes that use spdlog under the hood. However, I'm running into problems with my unit tests. My unit tests run in a single…
empty
  • 5,194
  • 3
  • 32
  • 58
1
2 3 4 5 6 7 8