
I thought about the problem for a while and came up with my own scheme. The approach I took was to separate streaming from the log implementation, this makes the log much more flexible: LOG(1, cdbg << "Hello World!" << std::endl); Logs the message if log bit 1 is set. LOG is a macro and cdbg a stream to the Windows debug output. I use a 64 bit set of flags so that multiple log levels, 1..64 can be turned on. The log flags can be defined dynamically or statically, with the static version the log flags are a constant and the compiler optimizes out LOG statements at compile time.
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Robert Zeh Sent: Thursday, May 19, 2005 10:46 AM To: boost@lists.boost.org Subject: [boost] Re: Logging library - your own scenario!
Our current logging is very simple. At start up, most of our applications specify a log file, which can be gotten later via a singleton. The singleton allows global access to an output stream for their logs.
There are a few things it doesn't do that we'd like in a logging framework:
1) Automatic timestamps, which are currently done manually.
2) Debug levels, so that some log messages could be ignored while others are actually written to the output stream. It would be nice if we could specify debug levels as a stream manipulator, ie:
log << debugLevel(5) << " reactor meltdown " << endl;
If the debug level is below 5, the reactor meltdown message is ignored. Sometimes we dynamically adjust the debug level, so that we can get more information from a misbehaving application.
Of course, you have to somehow specify when log level is being reset. I haven't thought that part through.
Robert Zeh Manager, Applications Development Error Free Software http:://home.earthlink.net/~rzeh
John Torjo <john.lists@torjo.com> writes:
Hi all,
In order to make the Logging lib as usable as it can be, I'd like to know what is *your* scenario, when using a Logging lib.
Thus, I'll do my best to make it as easy as possible to use my lib, and also tweak it to be easily usable in most common scenarios.
Even if you scenario fits an already described one, please just reply to that email with something like "mine too!", so that I'll know which scenarios are most common.
Thanks!
Best, John
-- John Torjo, Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -v1.6.3 (Resource Splitter) -- http://www.torjo.com/cb/ - Click, Build, Run!
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost