I am new to cpp (come from Java).
I am writing a cpp application. The application is performance critical.
i looked for a logging framework and i found log4cxx
at the end of the linked above there is performance section that explain:
When logging is turned off entirely or just for a set of levels, the
cost of a log request consists of a method invocation plus an integer
comparison
I remember from old days in university that we used then with #ifndf to wrap logging.
Questions:
-
Is wrapping logging with
#ifndfis still standard practice? -
Is there is something similar to the following pseudo-code?
logger.Log_Debug(() => { "My complicated log message " + thisFunctionTakesALongTime() + " will take no time" });
You can create your own macro that does nothing when in release mode: