Questions tagged [spdlog]

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

GitHub Project

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

63 questions
13
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
  • 656
  • 7
  • 19
10
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
  • 360
  • 1
  • 4
  • 16
6
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
  • 2,390
  • 4
  • 32
  • 58
6
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,138
  • 4
  • 35
  • 51
5
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
  • 489
  • 2
  • 11
  • 23
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,187
  • 1
  • 9
  • 19
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,422
  • 1
  • 23
  • 45
3
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
  • 129
  • 2
  • 11
2
votes
1 answer

In custom reverse vector iterator don't see first element

The other day I wanted to try writing my own iterators for a vector, of course, the most primitive example, since there is a lot of confusing code in the c++ standards. So the usual iterator for a vector in the forward direction works fine, but…
2
votes
1 answer

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
  • 19,236
  • 3
  • 55
  • 100
2
votes
2 answers

How do I expose a library's enum, such that my code doesn't have to type out the entire namespace to use that enum?

I'm using a library called spdlog for logging. I'd like to build my own Logger around the library so that I have the option of adding 'extra' functionality that's specific to my application. I was able to get this code below working: #include…
Max
  • 633
  • 6
  • 21
2
votes
1 answer

spdlog: failing to flush/write to file

I feel like a fool asking this, as it is about as trivial example as I can think of, but it's holding me up. I've implemented a very basic console-and-file logger: auto logger = spdlog::basic_logger_mt("console and file logger",…
Mike Sadler
  • 1,518
  • 1
  • 15
  • 31
2
votes
1 answer

spdlog error: "don't know how to format the type, include fmt/ostream.h if it provides an operator<< that should be used"

I've just picked up spdlog in an effort to improve our logging. Our logging is very basic, so I'm just copying the "multi sink" example almost verbatim to log to file and console. However, even when following the example exactly, I get: Error …
Mike Sadler
  • 1,518
  • 1
  • 15
  • 31
2
votes
1 answer

How to change the default rolling time in spdlog daily logger?

Using spdlog, how can I change the default rolling time of the daily logger? In the following example, the rolling happens only at midnight: auto logger = spd::daily_logger_st("my_logger", "fl_log.txt");
Ofiris
  • 5,727
  • 2
  • 32
  • 56
1
vote
1 answer

How can I read spdlog output in a google test

I am on the latest commit of spdlog (there is an issue regarding std output, apparently resolved), and am switching my output from std::cout to spdlog. My google tests redirect std::cout so I can check the output of stub functions: class MyTest :…
mike
  • 963
  • 6
  • 24
1
2 3 4 5