enhancement: -v, -vv, and -vvv

David Relson relson at osagesoftware.com
Tue Oct 22 14:14:27 CEST 2002


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.  When I first started using it, I didn't realize that I could 
make changes locally and cvs would still be able get updates for me and 
merge them in to my copy.  I went through all sorts of pain and effort to 
keep up-to-date before I realized this.  Now I have a customized source 
tree and let cvs update it for me (and fix the occasional conflict when 
necessary).


>>1) Using -p or -v produces an X-Bogosity header.
>>
>>2) Using -pv or -vv also output the 15 extrema tokens and their
>>probabilities to stdout.  Hence they will appear in the message after
>>the headers.
>>
>>3) Using -pvv or -vvv expands #2 with a couple more columns giving
>>details of the probability calculation.
>>
>>I have the verbose displays of getting/setting word values turned off.
>
>thanks for this last one, this was one of my chief complaints.  i agree
>with all of #1,2,3.  my issue is that "getting lock", "releasing lock"
>kind of debugging is still at -vv (verbose>1) where i would prefer that
>only the header and the 15 extrema tokens be generated.
>
>i am submitting a patch for datastore_db.c that simply moves all
>of the messages that bug me to -vvv (verbose>2).

Allyn,

In a case like this, I often add a "*0" to deactivate the statement, as in:

-  if (verbose > 1)
+  if (verbose*0 > 1)

This leaves the statement in place and allows me to easily reactivate it 
when I want to.

Gyepi,

This code is yours.  What do you want to do?

David


>--- datastore_db.c.orig 2002-10-21 23:43:35.000000000 -0700
>+++ datastore_db.c      2002-10-21 23:44:19.000000000 -0700
>@@ -249,7 +249,7 @@
>
>    dbh_t *handle = vhandle;
>
>-  if (verbose > 1)
>+  if (verbose > 2)
>      fprintf(stderr, "[%lu] Acquiring read lock  on %s\n",(unsigned 
> long)handle->pid, handle->filename);
>
>    if (db_lock(handle, F_SETLKW, F_RDLCK) != 0){
>@@ -257,7 +257,7 @@
>      exit(2);
>    }
>
>-  if (verbose > 1)
>+  if (verbose > 2)
>      fprintf(stderr, "[%lu] Got read lock  on %s\n",(unsigned 
> long)handle->pid, handle->filename);
>
>    handle->locked = TRUE;
>@@ -269,7 +269,7 @@
>  void db_lock_writer(void *vhandle){
>    dbh_t *handle = vhandle;
>
>-  if (verbose > 1)
>+  if (verbose > 2)
>      fprintf(stderr, "[%lu] Acquiring write lock on %s\n",(unsigned 
> long)handle->pid, handle->filename);
>
>    if (db_lock(handle, F_SETLKW, F_WRLCK) != 0){
>@@ -277,7 +277,7 @@
>      exit(2);
>    }
>
>-  if (verbose > 1)
>+  if (verbose > 2)
>      fprintf(stderr, "[%lu] Got write lock on %s\n",(unsigned 
> long)handle->pid, handle->filename);
>
>    handle->locked = TRUE;
>@@ -291,7 +291,7 @@
>    dbh_t *handle = vhandle;
>
>    if (handle->locked == TRUE){
>-    if (verbose > 1)
>+    if (verbose > 2)
>        fprintf(stderr, "[%lu] Releasing lock on %s\n",(unsigned 
> long)handle->pid, handle->filename);
>
>      if (db_lock(handle, F_SETLK, F_UNLCK) != 0){
>@@ -299,7 +299,7 @@
>        exit(2);
>      }
>    }
>-  else if (verbose > 1){
>+  else if (verbose > 2){
>      fprintf(stderr, "[%lu] Attempt to release open lock on 
> %s\n",(unsigned long)handle->pid, handle->filename);
>    }
>
>@@ -361,11 +361,11 @@
>        if (tmp->active == FALSE)
>         continue;
>
>-      if (verbose > 1)
>+      if (verbose > 2)
>         do_lock_msg("Trying");
>
>        if (db_lock(handle, cmd, type) == 0){
>-        if (verbose > 1)
>+        if (verbose > 2)
>            do_lock_msg("Got");
>
>          handle->locked = TRUE;
>
>---------------------------------------------------------------------
>FAQ: http://bogofilter.sourceforge.net/bogofilter-faq.html
>To unsubscribe, e-mail: bogofilter-dev-unsubscribe at aotto.com
>For summary digest subscription: bogofilter-dev-digest-subscribe at aotto.com
>For more commands, e-mail: bogofilter-dev-help at aotto.com





More information about the bogofilter-dev mailing list