From: Terence Wilson (tez_at_[hidden])
Date: 2005-05-22 22:38:05
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_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Robert Zeh
> Sent: Thursday, May 19, 2005 10:46 AM
> To: boost_at_[hidden]
> 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
> John Torjo <john.lists_at_[hidden]> 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:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk