caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Logging
@ 2006-07-20  9:20 Tiago Antão
  2006-07-20 10:14 ` [Caml-list] Logging Matthieu Dubuget
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tiago Antão @ 2006-07-20  9:20 UTC (permalink / raw)
  To: caml-list

Hi!

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Logging
  2006-07-20  9:20 Logging Tiago Antão
@ 2006-07-20 10:14 ` Matthieu Dubuget
  2006-07-20 19:27 ` James Woodyatt
  2006-07-21  8:59 ` Jean-Christophe Filliatre
  2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Dubuget @ 2006-07-20 10:14 UTC (permalink / raw)
  To: caml-list

Tiago Antão a écrit :
> Hi!
> 
> 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
> 
>

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 using.

Salutations

Matt


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Logging
  2006-07-20  9:20 Logging Tiago Antão
  2006-07-20 10:14 ` [Caml-list] Logging Matthieu Dubuget
@ 2006-07-20 19:27 ` James Woodyatt
  2006-07-21  8:59 ` Jean-Christophe Filliatre
  2 siblings, 0 replies; 4+ messages in thread
From: James Woodyatt @ 2006-07-20 19:27 UTC (permalink / raw)
  To: The Caml Trade

On Jul 20, 2006, at 2:20 AM, Tiago Antão wrote:
>
> 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)...

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 <jhw@conjury.org>





—
j h woodyatt <jhw@conjury.org>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Logging
  2006-07-20  9:20 Logging Tiago Antão
  2006-07-20 10:14 ` [Caml-list] Logging Matthieu Dubuget
  2006-07-20 19:27 ` James Woodyatt
@ 2006-07-21  8:59 ` Jean-Christophe Filliatre
  2 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe Filliatre @ 2006-07-21  8:59 UTC (permalink / raw)
  To: Tiago Antão; +Cc: caml-list


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-07-21  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-20  9:20 Logging Tiago Antão
2006-07-20 10:14 ` [Caml-list] Logging Matthieu Dubuget
2006-07-20 19:27 ` James Woodyatt
2006-07-21  8:59 ` Jean-Christophe Filliatre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).