From 851b86c88a136e04c6042b86687096eb9c7f3175 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Sun, 7 Sep 2003 09:53:48 +0000 Subject: [PATCH] use an integer debugging level instead of a boolean one --- helm/hbugs/common/hbugs_messages.ml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/helm/hbugs/common/hbugs_messages.ml b/helm/hbugs/common/hbugs_messages.ml index b7e6f5ddc..b320501ba 100644 --- a/helm/hbugs/common/hbugs_messages.ml +++ b/helm/hbugs/common/hbugs_messages.ml @@ -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 "\n%s\n" (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 = -- 2.39.2