Tiago AntÃ£o writes:
>
> Are there any best practices/libraries regarding logging in CAML? My
> main use for it will be debugging (I know there are debugging
> facilities in CAML, but I am very used to using log as a debug tool -
> think Log4J for instance)...
I'm also using logging as a debug facility sometimes, and I use a
printf-like function for this purpose, as follows:
======================================================================
let log_ch = open_out "logfile"
let log = Format.formatter_of_out_channel log_ch
let () = at_exit (fun () -> Format.pp_print_flush log (); close_out log_ch)
let lprintf s = Format.fprintf log s
======================================================================
which provides a function lprintf of type
======================================================================
val lprintf : ('a, Format.formatter, unit) format -> 'a = <fun>
======================================================================
to be used like Format.printf.
This is surely not the best way to do, and not very powerful, but at
least it is convenient to use when you already have Format-like
printers for your datatypes (using %a).
Hope this helps,
--
Jean-Christophe