]> matita.cs.unibo.it Git - helm.git/commitdiff
use an integer debugging level instead of a boolean one
authorStefano Zacchiroli <zack@upsilon.cc>
Sun, 7 Sep 2003 09:53:48 +0000 (09:53 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Sun, 7 Sep 2003 09:53:48 +0000 (09:53 +0000)
helm/hbugs/common/hbugs_messages.ml

index b7e6f5ddc59a5cd7bdbed32c0d91df5fbe668b17..b320501ba70eb4b570a9ffae0f74d517c3425fdf 100644 (file)
@@ -33,7 +33,10 @@ open Pxp_dtd;;
 open Pxp_types;;
 open Pxp_yacc;;
 
-let debug = true;;
+let debug = 2;; (*  0 -> no debug
+                    1 -> waiting for an answer / answer received
+                    2 -> XML messages dumping
+                *)
 
 exception Attribute_not_found of string;;
 exception Empty_node;;  (** found a node with no _element_ children *)
@@ -333,7 +336,7 @@ let string_of_msg = function
 
   (* debugging function that dump on stderr the sent messages *)
 let dump_msg msg =
-  if debug then
+  if debug >= 2 then
     prerr_endline
       (sprintf "<SENDING_MESSAGE>\n%s\n</SENDING_MESSAGE>"
         (match msg with
@@ -343,11 +346,11 @@ let dump_msg msg =
 
 let submit_req ~url msg =
   dump_msg msg;
-  if debug then (prerr_string "Waiting for an answer ... "; flush stderr);
+  if debug >= 1 then (prerr_string "Waiting for an answer ... "; flush stderr);
   let res =
     msg_of_string (Hbugs_misc.http_post ~body:(string_of_msg msg) url)
   in
-  if debug then (prerr_string "answer received!\n"; flush stderr);
+  if debug >= 1 then (prerr_string "answer received!\n"; flush stderr);
   res
 ;;
 let return_xml_msg body outchan =