#Removing debug logger calls for release builds

4 messages · Page 1 of 1 (latest)

livid dirge
#

Hey. I aimed to create a logging setup with 0 macros using spdlog, and I believe I've achieved an effective solution. What do you guys think?
I'm a bit unsure about whether the compiler will optimise out the debug log calls on release builds or not.

crude otterBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

livid dirge
livid dirge
#

The problem is that the following:```cpp
#include <logger.h>

int shift(int n1, int n2)
{
fmt::print("Ran func\n");

return n1 << n2;

}

int main()
{
logger::logloglevel::debug("Result: {}", shift(4, 2)).here();

return 0;

}
```Runs the shift function even though its output will be ignored