Questions tagged [spdlog]

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

GitHub Project

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

118 questions
0
votes
1 answer

Cannot format an argument. To make type T formattable provide a frormatter

So im creating a game engine in accordance to thecherno's tutorial and I am adding GLFW Error handling(This is c++) and I cannot figure out where and how to add a formatter for SPDLOG Here is my Log.h: #define PL_CORE_TRACE(...) …
0
votes
1 answer

C++ spdlog write logs to a file

I made a logger using spdlog which I use all over my program. But I also want to flush everything to a log file when the program is completed. How can I achieve this? I'm new to spdlog and I couldn't find proper documentation suitable for my…
Turgut
  • 711
  • 3
  • 25
0
votes
1 answer

C++ spdlog use variables

I'm new to spdlog and following a tutorial which looks like this: Log.h #pragma once #include "spdlog/spdlog.h" #include "spdlog/fmt/ostr.h" namespace Engine{ class Log{ public: static void init(); inline static…
Turgut
  • 711
  • 3
  • 25
0
votes
0 answers

Console Loggers Multithreaded Concurrence

I have the main application that uses boost log to output log to the console and library that uses spdlog to output to the console. Logs come from multiple threads. The question is how can I guarantee that the logs will not overlap each other
0
votes
1 answer

How to add a variable to spdlog's flag

I want to use spdlog for my code's logging. In my code, there is a important variable for the step in simulation, and I want it to be always displayed in my logs. Here is the format I wants. [log_level][the_special_variable][logger_name]…
Aaron Wu
  • 1
  • 4
0
votes
1 answer

How do I find "argument index out of range" from spdlog

I'm occasionally seeing this in syslog: [*** LOG ERROR #0027 ***] [2022-06-15 02:50:14] [MyApp] {argument index out of range} But how do I figure out which line of code or function this is coming from? Does LOG ERROR mean it's coming from a call to…
parsley72
  • 8,449
  • 8
  • 65
  • 98
0
votes
1 answer

Segmentation fault when logging using spdlog in an app that includes another spdlog

I have a native library that uses spdlog for internal logging. The library is compiled as shared library and the results .so files are then used in an Android project which has its own JNI and native c++ code which also uses spdlog. The first time a…
La bla bla
  • 8,558
  • 13
  • 60
  • 109
0
votes
1 answer

Wrapper for spdlog does not work with const char*

I'm writing a wrapper for spdlog, so that I can change spdlog for a different lib if there will be a need. My problem is that I cannot pass to spdlof::log a const char*. I'm receiving an error saying that it 'message' is not a constant expression.…
Kajetanoss
  • 159
  • 1
  • 2
  • 8
0
votes
2 answers

Make spdlog save the file before app crashes

I added logging capabilities to my application and it working fine. However in one particular case it is crashing, and in that case I cannot see the logs. Looks like my application is crashing before the log file is saved (I guess). Can I force…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
0
votes
0 answers

Logger not saving file when application crash, how to proceed?

So long story short, application is crashing. I'm trying to use spdlog to inspect the situation but looks like application crashes before log file is saved, so there is no log. Thinking about it I can imagine this actually is normal behavior of…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
0
votes
1 answer

What is the max_files in spdlog rotating files?

My understanding of this is that the file will be limited to the specified size. But I don't understand the max_files = 3, are we going to have one or three files? I run the example here and got one file. #include #include…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
0
votes
1 answer

How to play with spdlog?

I downloaded and followed the example 1. Moved to example 2 (Create stdout/stderr logger object) and got stuck. Actually I can run it as it is but if I change spdlog::get("console") to spdlog::get("err_logger") it crashes. Am I supposed to change it…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
0
votes
0 answers

C fopen from will return NULL in pybind11 module?

I'm trying to open a file in pybind11 module and write something into it. But FILE *fp = fopen("log/module_cc.log", "w"); will return NULL. Would you please help me with that ? Actually I'm trying to use spdlog for logging in pybind11 module, and it…
linrongbin
  • 2,967
  • 6
  • 31
  • 59
0
votes
1 answer

spdlog rotating/basic file logging out working in pybind11 modules?

I'm trying to logging something in pybind11 modules with spdlog. I add a static variable log_initializer, it's constructor will initialize spdlog. Here's the sample code: #include PYBIND11_MODULE(my_module, m) { // def my…
linrongbin
  • 2,967
  • 6
  • 31
  • 59
0
votes
1 answer

spdlog for C++; what(): Failed opening file ~/logs/log.txt for writing: No such file or directory

I am using spdlog to do some simple logging on a c++ program on a beaglebone, debian 10. I set up a rotating logger: auto logger = spdlog::rotating_logger_mt("runtime_log", "~/logs/log.txt", max_size, max_files); and this returns the error terminate…
Charkrit_A
  • 59
  • 5