At Thu, 19 Feb 2009 16:45:09 -0500, Carl Eastlund wrote: > On Thu, Feb 19, 2009 at 4:36 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote: > > > > 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'. > > Why not make log-error more like error and printf, such that you can write: > > (log-error "I got a bad value: ~s" v) > > If we're going to use format under the hood anyway, let's give the > user the benefit.
Technically, that adds an error-checking burden to `log-error', in case the format string and arguments don't match. One day, I hope, we'll figure out a consistent way to tell functions like `printf' that it should complain about mismatches on behalf of someone else, like `log-error'.
