mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-06 11:15:43 -05:00
capitalization of files; add new Log
This commit is contained in:
parent
bed469c0cf
commit
fc5a2d4e9d
30 changed files with 53 additions and 47 deletions
33
src/core/Log.ml
Normal file
33
src/core/Log.ml
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
(*
|
||||||
|
MSAT is free software, using the Apache license, see file LICENSE
|
||||||
|
Copyright 2014 Guillaume Bury
|
||||||
|
Copyright 2014 Simon Cruanes
|
||||||
|
*)
|
||||||
|
|
||||||
|
(** {1 Logging functions, real version} *)
|
||||||
|
|
||||||
|
let enabled = true (* NOTE: change here for 0-overhead *)
|
||||||
|
|
||||||
|
let debug_level_ = ref 0
|
||||||
|
let set_debug l = debug_level_ := l
|
||||||
|
let get_debug () = !debug_level_
|
||||||
|
|
||||||
|
let debug_fmt_ = ref Format.err_formatter
|
||||||
|
|
||||||
|
let set_debug_out f = debug_fmt_ := f
|
||||||
|
|
||||||
|
(* does the printing, inconditionally *)
|
||||||
|
let debug_real_ l k =
|
||||||
|
k (fun fmt ->
|
||||||
|
Format.fprintf !debug_fmt_ "@[<2>@{<Blue>[%d|%.3f]@}@ "
|
||||||
|
l (Sys.time());
|
||||||
|
Format.kfprintf
|
||||||
|
(fun fmt -> Format.fprintf fmt "@]@.")
|
||||||
|
!debug_fmt_ fmt)
|
||||||
|
|
||||||
|
let[@inline] debugf l k =
|
||||||
|
if enabled && l <= !debug_level_ then (
|
||||||
|
debug_real_ l k;
|
||||||
|
)
|
||||||
|
|
||||||
|
let[@inline] debug l msg = debugf l (fun k->k "%s" msg)
|
||||||
|
|
@ -6,13 +6,14 @@ Copyright 2014 Simon Cruanes
|
||||||
|
|
||||||
(** {1 Logging function, for debugging} *)
|
(** {1 Logging function, for debugging} *)
|
||||||
|
|
||||||
val set_debug : int -> unit (** Set debug level *)
|
val enabled : bool
|
||||||
val get_debug : unit -> int (** Current debug level *)
|
|
||||||
|
val set_debug : int -> unit (** Set debug level *)
|
||||||
|
val get_debug : unit -> int (** Current debug level *)
|
||||||
|
|
||||||
val debugf :
|
val debugf :
|
||||||
int ->
|
int ->
|
||||||
('a, Format.formatter, unit, unit) format4 ->
|
((('a, Format.formatter, unit, unit) format4 -> 'a) -> unit) ->
|
||||||
('a -> unit) ->
|
|
||||||
unit
|
unit
|
||||||
(** Emit a debug message at the given level. If the level is lower
|
(** Emit a debug message at the given level. If the level is lower
|
||||||
than [get_debug ()], the message will indeed be emitted *)
|
than [get_debug ()], the message will indeed be emitted *)
|
||||||
15
src/core/jbuild
Normal file
15
src/core/jbuild
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
; vim:ft=lisp:
|
||||||
|
|
||||||
|
(jbuild_version 1)
|
||||||
|
|
||||||
|
; main binary
|
||||||
|
(library
|
||||||
|
((name msat)
|
||||||
|
(public_name msat)
|
||||||
|
(synopsis "core data structures and algorithms for msat")
|
||||||
|
(libraries ())
|
||||||
|
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string))
|
||||||
|
(ocamlopt_flags (:standard -O3 -bin-annot
|
||||||
|
-unbox-closures -unbox-closures-factor 20))
|
||||||
|
))
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
log_real.ml
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
(*
|
|
||||||
MSAT is free software, using the Apache license, see file LICENSE
|
|
||||||
Copyright 2014 Guillaume Bury
|
|
||||||
Copyright 2014 Simon Cruanes
|
|
||||||
*)
|
|
||||||
|
|
||||||
(** {1 Logging functions, dummy version}
|
|
||||||
|
|
||||||
This does nothing. *)
|
|
||||||
|
|
||||||
let debug_level_ = ref 0
|
|
||||||
let set_debug l = debug_level_ := l
|
|
||||||
let get_debug () = !debug_level_
|
|
||||||
|
|
||||||
let debugf _ _ _ = ()
|
|
||||||
let debug _ _ = ()
|
|
||||||
|
|
||||||
let set_debug_out _ = ()
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
(*
|
|
||||||
MSAT is free software, using the Apache license, see file LICENSE
|
|
||||||
Copyright 2014 Guillaume Bury
|
|
||||||
Copyright 2014 Simon Cruanes
|
|
||||||
*)
|
|
||||||
|
|
||||||
(** {1 Logging functions, real version} *)
|
|
||||||
|
|
||||||
let debug_level_ = ref 0
|
|
||||||
let set_debug l = debug_level_ := l
|
|
||||||
let get_debug () = !debug_level_
|
|
||||||
|
|
||||||
let debug_fmt_ = ref Format.err_formatter
|
|
||||||
|
|
||||||
let set_debug_out f = debug_fmt_ := f
|
|
||||||
|
|
||||||
let debugf l format k =
|
|
||||||
if l <= !debug_level_
|
|
||||||
then
|
|
||||||
k (Format.kfprintf
|
|
||||||
(fun fmt -> Format.fprintf fmt "@]@.")
|
|
||||||
!debug_fmt_ format)
|
|
||||||
|
|
||||||
let debug l msg = debugf l "%s" (fun k->k msg)
|
|
||||||
Loading…
Add table
Reference in a new issue