struct
let debugged = ref []
let enable s =
debugged := s :: !debugged
let disable s =
debugged := List.filter !debugged ((<>) s)
let is_enabled s =
List.mem !debugged s
let make prefix fmt =
ksprintf (fun s ->
if is_enabled prefix then (
eprintf "%s: " prefix;
String.iter s (function
| '\n' -> eprintf "\n "
| c -> eprintf "%c" c);
eprintf "\n%!"
)
) fmt
end