I want to record many events in a dynamic search algorithm (for example, information about convergence to a global optimum). This log must have a switch to disable / enable. Now there are many possibilities for this:
- implement the log version and non-log version of the algorithm β reservation
- use macros -> ugly and not so safe
- use the C ++ protocol library (or: use 1% of the functional range of the logging library).
I decided to use Pantheios , especially because of the stated performance requirements (I do not want to lose much performance due to this logging, which is necessary only for development). I have to admit that I do not need most of the functionality of this library, but I thought it would be much better / safer to use it. Maybe there would be a more suitable alternative that I do not know about (I need solutions at compile time for logging only - I donβt know if there are log libraries designed for this purpose).
After compiling, installing and final linking (without success with manual binding, but using the scons tool , using gcc β explicit binding), I wanted to try a small example.
Let me reduce this to the following:
#include "pantheios/pantheios.hpp"
#include "pantheios/frontends/stock.h"
const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = "pantheios_test";
int main()
{
pantheios::log_ALERT("alert-event");
pantheios::log_DEBUG("debug-event");
pantheios::log_INFORMATIONAL("just information");
return 1;
}
Linking is performed with the following files:
LIBS=['pantheios.1.core.gcc44', 'pantheios.1.be.fprintf.gcc44', 'pantheios.1.bec.fprintf.gcc44',
'pantheios.1.fe.all.gcc44', 'pantheios.1.util.gcc44']
A simple question: how to disable / disable console output? How to choose the severity level that is provided to the server?
A look at the documentation leads me to a lot of functions that occupy a severity level, but these functions are automatically called once to initialize. I know that dynamic changes in severity levels are possible. I do not know exactly where I change these settings. I think they should be in the front-end component. Are there any solutions already associated with fe_all whose level is registered, at which level not?
This should be relatively easy, because in my case I only need a solution at compile time about I / O.
Thank you for your help.
Sasha