[plt-dev] logging: strings vs. sexps

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Feb 19 16:39:04 EST 2009

What was the intention of putting the current-continuation-marks into the log?

Robby

On Thu, Feb 19, 2009 at 3:36 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Thu, 19 Feb 2009 14:51:47 -0600, Robby Findler wrote:
>> On Thu, Feb 19, 2009 at 2:50 PM, Grant Rettke <grettke at acm.org> wrote:
>> > On Thu, Feb 19, 2009 at 12:12 PM, Eli Barzilay <eli at barzilay.org> wrote:
>> >> On Feb 19, Robby Findler wrote:
>> >>> I think Eli's asking 'why not do (log-info (format "~s"
>> >>> my-sexp))?'. Right?
>> >>
>> >> [Uh, yeah, but that looks so much boring...]
>> >
>> > Is (log-info-sexpr ...) less boring?
>> >
>>
>> It is such a short macro; do we really need to add 3 more exports to
>> scheme/base for that?
>
> Maybe it's not that `log-message' needs to change, but that the
> `log-error', etc. forms make the wrong thing easy.
>
> Currently,
>
>  (log-error expr)
>
> expands to
>
>  (let ([l (current-logger)])
>    (when (log-level? l 'error)
>      (log-message l 'error expr (current-continuation-marks))))
>
>
> What if we change it to
>
>  (let ([l (current-logger)])
>    (when (log-level? l 'error)
>      (let ([v expr])
>        (log-message l 'error (format "~s" v) v))))
>
> ?
>
> This changes both the formatting and the value supplied to log
> receivers by `log-error'. Programmers who want more control over the
> message and data can still use `log-message'.
>
>


Posted on the dev mailing list.