caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe Filliatre <filliatr@lri.fr>
To: "Tiago Antão" <tiagoantao@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Logging
Date: Fri, 21 Jul 2006 10:59:52 +0200	[thread overview]
Message-ID: <17600.38792.566702.750339@pc9-152.lri.fr> (raw)
In-Reply-To: <6d941f120607200220p5f09b8cby15c2f1c1669abf6b@mail.gmail.com>


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


      parent reply	other threads:[~2006-07-21  8:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17600.38792.566702.750339@pc9-152.lri.fr \
    --to=filliatr@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=tiagoantao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).