enhancement: -v, -vv, and -vvv

David Relson relson at osagesoftware.com
Tue Oct 22 16:02:41 CEST 2002


At 09:29 AM 10/22/02, Gyepi SAM wrote:

>On Tue, Oct 22, 2002 at 08:14:27AM -0400, David Relson wrote:
> > At 02:54 AM 10/22/02, Allyn Fratkin wrote:
> >
> > >ok, i learned how to use cvs today.  :-)
> >
> > It's a very useful tool.  I've been using it for several years and 
> learning
> > more as I go.
>
>It's not perfect, but it does a fine job of taking care of the details
>so we don't have to.
>
>
> > In a case like this, I often add a "*0" to deactivate the statement, as in:
> >
> > -  if (verbose > 1)
> > +  if (verbose*0 > 1)
>
>I usually use
>
>      if (0 && verbose > 1)

I'll put it in with the "0 &&" syntax.


> > Gyepi,
> >
> > This code is yours.  What do you want to do?
>
>I think this change is fine.
>Lower level details should only be visible with increased
>verbosity. This does become a problem when one is debugging a section and 
>is not interested in the
>others, but gets them anyway. One solution I have seen is to use a bitmask 
>for different sections of code:
>  general == 1
>  lexer == 2
>  database == 4
>  spamicity = 8
>
>   so specifying a debug flag of 5 means that I am only interested in 
> general and database messages.

I like the bitmask idea.  How about a "-m [glds]" switch to set the mask 
(with a list of single characters to indicate the sections) and a set of 
macros to test the mask and verbosity level.  For example, for the database 
stuff,

         if (verbose > 1)

would become:

         if (DEBUG_DATABASE(1))

where the macro is

#define DEBUG_DATABASE(level)  ((bit_mask & BIT_DATABASE) && (verbose > level))
typedef enum bit_e {BIT_GENERAL=1, BIT_LEXER=2, BIT_DATABASE=4, ...} bit_t;

I think this would work without being difficult to use.  I'm even willing 
to implement it and take a first pass at converting the code.

David





More information about the bogofilter-dev mailing list