X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=helm%2Focaml%2Fgetter%2Fhttp_getter_logger.ml;fp=helm%2Focaml%2Fgetter%2Fhttp_getter_logger.ml;h=0000000000000000000000000000000000000000;hp=f77b5eba86613f30b3c09c1b65fe9a0bccfef617;hb=1696761e4b8576e8ed81caa905fd108717019226;hpb=5325734bc2e4927ed7ec146e35a6f0f2b49f50c1 diff --git a/helm/ocaml/getter/http_getter_logger.ml b/helm/ocaml/getter/http_getter_logger.ml deleted file mode 100644 index f77b5eba8..000000000 --- a/helm/ocaml/getter/http_getter_logger.ml +++ /dev/null @@ -1,61 +0,0 @@ -(* - * Copyright (C) 2003-2004: - * Stefano Zacchiroli - * for the HELM Team http://helm.cs.unibo.it/ - * - * This file is part of HELM, an Hypertextual, Electronic - * Library of Mathematics, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * HELM is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * HELM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with HELM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the HELM World-Wide-Web page, - * http://helm.cs.unibo.it/ - *) - -let log_level = ref 1 -let get_log_level () = !log_level -let set_log_level l = log_level := l - -(* invariant: if logfile is set, then logchan is set too *) -let logfile = ref None -let logchan = ref None - -let set_log_file f = - (match !logchan with None -> () | Some oc -> close_out oc); - match f with - | Some f -> - logfile := Some f; - logchan := Some (open_out f) - | None -> - logfile := None; - logchan := None - -let get_log_file () = !logfile - -let close_log_file () = set_log_file None - -let log ?(level = 1) s = - if level <= !log_level then - let msg = "[HTTP-Getter] " ^ s in - match (!logfile, !logchan) with - | None, _ -> prerr_endline msg - | Some fname, Some oc -> - output_string oc msg; - output_string oc "\n"; - flush oc - | Some _, None -> assert false -