[plt-dev] logging: strings vs. sexps

From: Dave Herman (dherman at ccs.neu.edu)
Date: Thu Feb 19 11:46:14 EST 2009

The new logging facility is very cool, but I think it's missing a great 
opportunity: if ever there was a perfect use case for S-expressions, 
it's logs. They're extremely human readable (esp. to Schemers), and 
extremely manipulable programmatically.

In my experience, when you add logging to an app you discover two needs, 
in this order:

1. the need to generate logging info conveniently
2. the need to manipulate existing logs and mine them for data

Strings are pretty good for #1, but they're pretty bad for #2. 
S-expressions are great at both.

The `log-message' procedure (etc.) would need to be generalized from 
taking a string to taking an S-expression, but this would require one 
backwards-incompatible change: the system would have to `write' the 
data, not `display' it. Otherwise you'd get entries like

     (foo #t 42 don't tell anyone. hello, world)

Logging is still a pretty new feature, so I bet it's not too late to 
make this change. Opinions?

Dave


Posted on the dev mailing list.