[plt-dev] logging: strings vs. sexps

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Feb 19 16:17:19 EST 2009

On Feb 19, YC wrote:
> On Thu, Feb 19, 2009 at 12:53 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > > It is such a short macro; do we really need to add 3 more
> > > exports to scheme/base for that?
> >
> > +1 for not adding it, for exactly that reason.  (It probbaly
> > doesn't even have to always be a macro, since the sexpr will
> > usually not be expensive to construct.)
> what if you want to do intermediate processing on the log before
> flushing it out to the stream?
> I think that's where logging sexp (or other objects) would be
> useful.  For example, have the log receiver receiving a sexp and
> immediately handle the information contained in sexp without having
> to incur the cost of parsing.

There are at least two features of the current system that provide
answers for this: the `log-info' and its friends are macros -- they
don't do anything if there is no receiver, which makes it convenient
to give them an argument that will do whatever processing you want to
do.  So you can pass around sexprs, and do whatever you want to do
with them before you turn them into strings for the output.  Also,
`log-message' receives an argument that contains arbitrary
information, which you can use to hook additional bits.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the dev mailing list.