Make level a keyword argument for with-logging-to-port.

original commit: 0538f21274720a6deb5ff6575843f4b081eeb832
This commit is contained in:
Vincent St-Amour 2011-06-01 15:24:15 -04:00
parent daba37e8ff
commit 515cc1433f

View File

@ -11,7 +11,7 @@
;; (log-warning "not ok")
;; If the logging on the last line is executed before the thread listening
;; to the logs sees the stop message, "not ok" will also be sent to port.
(define (with-logging-to-port port level proc)
(define (with-logging-to-port port proc #:level [level 'debug])
(let* ([logger (make-logger #f (current-logger))]
[receiver (make-log-receiver logger level)]
[stop-chan (make-channel)]
@ -41,7 +41,6 @@
(thread-wait t))))
(provide/contract [with-logging-to-port
(-> output-port?
(or/c 'fatal 'error 'warning 'info 'debug)
(-> any)
any)])
(->* (output-port? (-> any))
(#:level (or/c 'fatal 'error 'warning 'info 'debug))
any)])