change `log-error', etc., to support format mode

One subexpression => string literal. Multiple subexpressions
=> arguments to `format'.
This commit is contained in:
Matthew Flatt 2012-09-06 10:44:40 -06:00
parent b53e458e3f
commit fc0d605d18
3 changed files with 18 additions and 10 deletions

View File

@ -345,7 +345,9 @@
#'(define-syntax (id stx)
(syntax-case stx ()
[(_ str-expr)
#'(log-it id mode str-expr)]))]))
#'(log-it id mode str-expr)]
[(_ str-expr arg (... ...))
#'(log-it id mode (format str-expr arg (... ...)))]))]))
(define-log log-fatal fatal)
(define-log log-error error)
(define-log log-warning warning)

View File

@ -130,18 +130,23 @@ currently returns @racket[#f] for all levels.}
@deftogether[(
@defform[(log-fatal string-expr)]
@defform[(log-error string-expr)]
@defform[(log-warning string-expr)]
@defform[(log-info string-expr)]
@defform[(log-debug string-expr)]
@defform*[[(log-fatal string-expr)
(log-fatal format-string-expr v ...)]]
@defform*[[(log-error string-expr)
(log-error format-string-expr v ...)]]
@defform*[[(log-warning string-expr)
(log-warning format-string-expr v ...)]]
@defform*[[(log-info string-expr)
(log-info format-string-expr v ...)]]
@defform*[[(log-debug string-expr)
(log-debug format-string-expr v ...)]]
)]{
Log an event with the @tech{current logger}, evaluating
@racket[string-expr] only if the logger has receivers that are
interested in the event. In addition, the current continuation's
@tech{continuation marks} are sent to the logger with the message
string.
@racket[string-expr] or @racket[(format format-string-expr v ...)]
only if the logger has receivers that are interested in the event. In
addition, the current continuation's @tech{continuation marks} are
sent to the logger with the message string.
For each @racketkeywordfont{log-}@racket[_level],

View File

@ -1,6 +1,7 @@
Version 5.3.0.22
Changed a thread's initial prompt to use the default handler
(instead of accepting and ignoring abort arguments)
Changed log-error, etc., to support format mode
Added racket/format, which is re-exported by racket
ffi/unsafe: added cpointer-gcable?
racket/class: added dynamic-get-field and dynamic-set-field!