1 (***********************************************************************)
4 (* Nicolas Pouillard, Berke Durak, projet Gallium, INRIA Rocquencourt *)
6 (* Copyright 2007 Institut National de Recherche en Informatique et *)
7 (* en Automatique. All rights reserved. This file is distributed *)
8 (* under the terms of the Q Public License version 1.0. *)
10 (***********************************************************************)
13 (* Original author: Nicolas Pouillard *)
23 let classic_display = ref false
24 let internal_display = ref None
25 let failsafe_display = lazy (Display.create ~
mode:`Classic ~log_level
:!level ())
29 | None
-> !*failsafe_display
34 if !classic_display || !*My_unix.is_degraded
|| !level <= 0 || not
(My_unix.stdout_isatty
()) then
39 internal_display := Some
(Display.create ~
mode ?log_file ~log_level
:!level ())
41 let raw_dprintf log_level
= Display.dprintf ~log_level
!-internal_display
43 let dprintf log_level fmt
= raw_dprintf log_level
("@[<2>"^^fmt^^
"@]@.")
44 let eprintf fmt
= dprintf (-1) fmt
46 let update () = Display.update !-internal_display
47 let event ?pretend x
= Display.event !-internal_display ?pretend x
48 let display x
= Display.display !-internal_display x
51 match !internal_display with
53 | Some d
-> Display.finish ?how d
55 (*let () = My_unix.at_exit_once finish*)