X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_proof_checking%2FcicLogger.ml;h=5921c61b0cf7c47ba17c938f685e963a7fac791f;hb=b1bad322d0daf6c25f95a82c4349f057a753ab7c;hp=6867b8b928314bbbc73226610f30d4a5714a7185;hpb=98295941bee765a0cb4070eb3f2df553228c11c8;p=helm.git diff --git a/helm/ocaml/cic_proof_checking/cicLogger.ml b/helm/ocaml/cic_proof_checking/cicLogger.ml index 6867b8b92..5921c61b0 100644 --- a/helm/ocaml/cic_proof_checking/cicLogger.ml +++ b/helm/ocaml/cic_proof_checking/cicLogger.ml @@ -23,22 +23,40 @@ * http://cs.unibo.it/helm/. *) +(* $Id$ *) + type msg = [ `Start_type_checking of UriManager.uri | `Type_checking_completed of UriManager.uri | `Trusting of UriManager.uri ] -let log = +let log ?(level = 1) = let module U = UriManager in function | `Start_type_checking uri -> - HelmLogger.log (`Msg (`DIV (1, None, `T + HelmLogger.log (`Msg (`DIV (level, None, `T ("Type-Checking of " ^ (U.string_of_uri uri) ^ " started")))) | `Type_checking_completed uri -> - HelmLogger.log (`Msg (`DIV (1, Some "green", `T + HelmLogger.log (`Msg (`DIV (level, Some "green", `T ("Type-Checking of " ^ (U.string_of_uri uri) ^ " completed")))) | `Trusting uri -> - HelmLogger.log (`Msg (`DIV (1, Some "blue", `T + HelmLogger.log (`Msg (`DIV (level, Some "blue", `T ((U.string_of_uri uri) ^ " is trusted.")))) +class logger = + object + val mutable level = 0 (* indentation level *) + method log (msg: msg) = + match msg with + | `Start_type_checking _ -> + level <- level + 1; + log ~level msg + | `Type_checking_completed _ -> + log ~level msg; + level <- level - 1; + | _ -> log ~level msg + end + +let log msg = log ~level:1 msg +