From a8ab5ff0a54358955e555c065e6707703b2f1026 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Sun, 17 Nov 2002 16:15:01 +0000 Subject: [PATCH] Added debug flag and debug_print function --- helm/DEVEL/ocaml-http/http_common.ml | 7 +++++++ helm/DEVEL/ocaml-http/http_common.mli | 6 ++++++ 2 files changed, 13 insertions(+) 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 -- 2.39.2