P
pmatos
Hi all,
I am trying to create a simple but efficient C++ logging class. I know
there are lots of them out there but I want something simple and
efficient. The number one requirement is the possibility of shutting
logging down at compile time and suffer no performance penalty
whatsoever for getting logging on whenever I wish. Of course that I
would need to recompile the project each time I want to turn logging on
or off. But given a LOGGING variable what's the best way to turn log on
or off with no performance penalty?
My idea is to have a singleton logger class to log to a file or to
stdout and then provide some macros that would be used all around the
code that would either not do anything or call logging object methods
if LOGGING is defined.
Are any better ideas out there?
Cheers,
Paulo Matos
I am trying to create a simple but efficient C++ logging class. I know
there are lots of them out there but I want something simple and
efficient. The number one requirement is the possibility of shutting
logging down at compile time and suffer no performance penalty
whatsoever for getting logging on whenever I wish. Of course that I
would need to recompile the project each time I want to turn logging on
or off. But given a LOGGING variable what's the best way to turn log on
or off with no performance penalty?
My idea is to have a singleton logger class to log to a file or to
stdout and then provide some macros that would be used all around the
code that would either not do anything or call logging object methods
if LOGGING is defined.
Are any better ideas out there?
Cheers,
Paulo Matos