glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] Error handling and reporting


From: Andrew Sayers
Subject: Re: [glob2-devel] Error handling and reporting
Date: Fri, 7 Oct 2005 08:29:05 +0100
User-agent: Mutt/1.5.11

I now have a solution that I think I like.  I've taken more inspiration
from Simon than it probably looks like, so thanks to him for the ideas.
The solution is described more completely here:
        
http://savannah.nongnu.org/cgi-bin/viewcvs/glob2/glob2/doc/Attic/Debugging.txt?rev=1.1.2.2&only_with_tag=map-rewrite&content-type=text/vnd.viewcvs-markup

It's more verbose than a simple assert(), but tries to be more flexible
too.  Basically, the idea is that you define a debugging class in your
class definition, something like:

        typedef Debug<testLevel, logLevel> debug;

Then put checks in your code like:

        if (!debug::invariant(test))
                debug::error(DEBUG_INFO) << test << debug::terminate();

The benefit of using a debugging class here is that you can compile all
your debugging code in or out in one go by setting the levels correctly,
or you can set them to only run depending on the current debugging
level, set by the user at run-time.

I'd like this solution to be used throughout Glob2, and I intend to put
it into code that I edit, so could people have a look at it and see how
they like it before it's too late to change?

        - Andrew




reply via email to

[Prev in Thread] Current Thread [Next in Thread]