Questions tagged [spdlog]

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

GitHub Project

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

118 questions
0
votes
0 answers

spdlog async multiple loggers sharing a file synk, one of those always writing only on flush or shutdown

I have multiple loggers writing into a file in async mode. There is a logger that is always writing on the file, i think only when shutting down / flush the log. here a sample of logs: [2023-09-02 10:40:04.949| 27228][ * APP. debug] Application is…
Raffaello
  • 1,641
  • 15
  • 29
0
votes
1 answer

Wrapping a Call to Spdlog Inside a Variadic Macro

I am using the spdlog library in a C++20 project using modules. I've encapsulated spdlog inside my singleton logger class because I don't want spdlog exposed to clients in case I swap it out for a different log library someday. But now I want a…
Todd Burch
  • 200
  • 8
0
votes
1 answer

Using SpdLog With Modules/C++20 Gives Internal Compiler Error (MSVC 2022)

I am trying to encapsulate the header-only spdlog logging library in a C++20 module that keeps the spdlog library internal to the module. The Logger class is a Meyers-style singleton which I thought would be straightforward but is giving me a lot of…
Todd Burch
  • 200
  • 8
0
votes
1 answer

LNK2038 mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in cmake_pch.obj

I am trying to statically link my program with spdlog. I have built spdlog from source using the Debug configuration, and I have specifically cleared the "Runtime Library" setting to avoid any CRT incompatibilities with my project. However, when I…
Dan
  • 1,198
  • 4
  • 17
  • 34
0
votes
0 answers

How to import spdlog into a CMake project?

I'm desperately trying to understand how cmake works. I inherited a project that uses cmake, and needs spdlog, but I simply cannot make cmake be able to generate the makefiles, because I cannot produce a working Findspdlog.cmake for find_package to…
Gergely Nagy
  • 73
  • 1
  • 5
0
votes
0 answers

Wrong order of logs(spdlog) within QTextEdit in qt5

I have asked on thread, but seems no good solutions. And I know limitations of current way. But, I wanna try once more here. Please note I'm using spdlog for logging. I meet a problem when I logging to qt widget QTextEdit with different…
taptiptop
  • 13
  • 6
0
votes
2 answers

High-load C++ logging

I’m using spdlog library in my high-load service. Also my service is getting requests from another service by gRPC. At this moment I can’t use streaming gRPC, and every call creates its own connection. As I know I can’t restrict threads count gRPC…
Leonid
  • 75
  • 1
  • 7
0
votes
1 answer

segfault caused by a call to spdlog::get( "logger" )->info() in a file_event_handlers's callback

The below program crashes due to a seg fault. I don't find a reason for this. All I know at the moment is that the two calls to info() member spdlog::get( "basic_logger" )->info( "\nLogging started..." ); and spdlog::get( "basic_logger" )->info(…
digito_evo
  • 3,216
  • 2
  • 14
  • 42
0
votes
0 answers

No spdlog output for file sinks - stdout sink works

I have a fairly basic singleton logger class that wraps around spdlog, and that I intend to use throughout my code via the macros defined to log to files. The problem I am having is that I cannot get it to log to files. If I use the…
0
votes
0 answers

Should logging library be linked to exe in Release/Distribution build?

I am currently implementing a library where I use spdlog for logging. In order to disable logging in Release mode the following can be implemented: #if !defined(NDEBUG) LOG(...) Logger::log(__VA_ARGS__) #else #define LOG(...) (void)0 #endif So if…
0
votes
0 answers

For Spdlog in C++, the typical example is to declare your log inside a function, but what if you want a single log used globally?

This may be a stupid, obvious typing question that I'm just overlooking a simple explanation for, so apologies. While using spdlog, the examples are ALL declared in functions, in my case like this: void daily_example() { auto daily_logger =…
0
votes
0 answers

Linkage errors with cmake build to shared system "spdlog" library

Update: I finally could solve this problem on my own after (see below [#Solution]) this post getting automaticaly flagged as CLOSED & some further hours of digging the web & some helpful comments - Huge thanks! This post solved the issue. I'm…
jnnk
  • 1
  • 1
0
votes
1 answer

How to print time in log file using spdlog

How should I print the time when opening and closing a log file? Here: #include #include #include int main( ) { spdlog::file_event_handlers handlers; handlers.after_open =…
digito_evo
  • 3,216
  • 2
  • 14
  • 42
0
votes
0 answers

How to manage importing library using CMake in c++ error

I want to import spdlog in my project using CMake. And I use VS Code. But my code doesn't work well. I think I don't have any problem in my code because I copy and paste all professor's code. I think that it is simple setting error, but I don't know…
0
votes
2 answers

How to format the output of the spdlog macros?

How can I format the output of SPDLOG macro calls to exclude [main.cpp:9] parts? #include int main() { SPDLOG_DEBUG("SMTH1"); SPDLOG_TRACE("SMTH2"); SPDLOG_INFO("SMTH3"); } default output: [2022-11-11 21:07:28.346]…
lbsmart
  • 83
  • 6