From: Stefano Zacchiroli Date: Sun, 17 Nov 2002 16:15:01 +0000 (+0000) Subject: Added debug flag and debug_print function X-Git-Tag: V_0_0_3~5 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=a8ab5ff0a54358955e555c065e6707703b2f1026;p=helm.git Added debug flag and debug_print function --- diff --git a/helm/DEVEL/ocaml-http/http_common.ml b/helm/DEVEL/ocaml-http/http_common.ml index 28b7201b9..1db14b7fc 100644 --- a/helm/DEVEL/ocaml-http/http_common.ml +++ b/helm/DEVEL/ocaml-http/http_common.ml @@ -19,6 +19,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) +open Printf;; + +let debug = ref false +let debug_print s = + if !debug then + prerr_endline (sprintf "DEBUG: %s" s) + exception Invalid_HTTP_version of string exception Invalid_code of int exception Invalid_status of Http_types.status diff --git a/helm/DEVEL/ocaml-http/http_common.mli b/helm/DEVEL/ocaml-http/http_common.mli index 447f317e7..bd7ff3079 100644 --- a/helm/DEVEL/ocaml-http/http_common.mli +++ b/helm/DEVEL/ocaml-http/http_common.mli @@ -19,6 +19,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) + (** whether debugging messages are enabled or not, can be changed at runtime + *) +val debug: bool ref + (** print a string on stderr only if debugging is enabled *) +val debug_print: string -> unit + exception Invalid_HTTP_version of string exception Invalid_code of int exception Invalid_status of Http_types.status