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)...
Thanks a lot,
Tiago
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
I do not know Log4J. For the same purpose as yours, I did a small Log
library, using another one, called Tics.
Tics is a binding to QueryPerformanceCouter and al. on MS Windows. At
this moment, it is not multiplatform, but this should be done very easily.
I need Tics because each message sent to Log is timestamped and stored
in memory. The user of Log then can flush and print or display the
stored message when possible.
I did this because I have plenty of memory for those tests, and I wanted
to avoid IO perturbations of timing. I also needed precise timing,
because I'm working with hardware.
Except from those constraint, I really don't think my tools are forth usi
ng.
Salutations
Matt
You may want to have a look at the Cf_journal module in my recently
released OCaml NAE Core Foundation library. See <http://sf.net/
projects/ocnae/> for downloads. It's not anywhere near as full-
featured as Log4J, but it was intended as a foundation upon which to
build something that full-featured.
I find it works pretty well for debugging purposes. Your mileage may
vary.
—
j h woodyatt <j...@conjury.org>
—
j h woodyatt <j...@conjury.org>
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