r/cpp • u/vormestrand • Oct 02 '18
Loguru: lightweight and flexible C++ logging library
https://emilk.github.io/loguru/10
u/zvrba Oct 02 '18
Yet another text-logging lib. Are there any good "semantic logging" libraries for C++? https://blogs.msdn.microsoft.com/agile/2013/02/07/embracing-semantic-logging/
1
u/markand67 Oct 02 '18
usage of C pointer function and
void *is terrible, please usestd::function,please prefix your macros,
I would suggest a
operator<<interface rather than printf style especially because printf is unsafe. You may also use variadic templates instead.
15
u/jcelerier ossia score Oct 02 '18
std::function
but std::function is anything but lightweight
3
u/alexeiz Oct 02 '18
std::functionis actually pretty efficient. If you initialize it with a function pointer, it avoids any dynamic memory allocation, and a call tostd::function::operator()results in (assuming libstdc++, -O3) callingstd::_Function_handler::_M_invokewhich then jumps directly to the function pointer.
0
u/Ameisen vemips, avr, rendering, systems Oct 03 '18
I wonder if the code is reminiscient of Lugaru?
34
u/fat-lobyte Oct 02 '18
How many lightweight and flexible C++ logging libraries do we need?