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 *)
(* 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
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 =