(define (on-complete x) (log-test-debug "entering on-complete") x)
(struct person (name) #:transparent)
(log-bracketed test-debug "on-complete" "time: ~a" (current-seconds) (on-complete (person 'bob)))
(log-bracketed test-debug "on-complete" "" "no user-specified logging information")
test: about to on-complete. time: 1630611613
test: entering on-complete
test: after on-complete. time: 1630611613. result: (person 'bob)
(person 'bob)
test: about to on-complete
test: after on-complete. result: "no user-specified logging information"
"no user-specified logging information"
(with-bracketing-logs ([test-debug "on-complete" "time: ~a" (current-seconds)])
(on-complete (person 'bob))
--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAE8gKocZha-NpiFAAKT1c8QTG3MDFRnvxCD4T0P269EncZW3KQ%40mail.gmail.com.
Thoughts:
(current-logger)
.raise-arguments-error
.Example:
(define (on-complete x)
(log-test-debug "I'm in on-complete")
x)
(with-log ()
1)
(with-log (#:logger test-debug
#:msg "on-complete"
["time" (current-seconds)])
(on-complete (person 'bob)))
would output:
test: entering test.rkt:5:1
test: exiting test.rkt:5:1
result: 1
1
test: entering on-complete
time: 123
test: I'm in on-complete
test: exiting on-complete
time: 124
result: (person 'bob)
(person 'bob)
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAFrFfuEqt1NVjE2Ft1JVArvWnKUBvK7jPVoLqPhYCd-dB00A3Q%40mail.gmail.com.
On Thu, Sep 2, 2021 at 2:06 PM Martin DeMello <martin...@gmail.com> wrote:I do like the second form better, especially since the actual code being run is not obscured by simply being the last argument to a long log function.