Keyword arguments are all optional. #:to and #:at may appear in either order but #:with must come last if it is present.
(define-logger foo)
(define (on-complete op . args)
(log-foo-debug "in on-complete")
(apply op args))
(in/out-logged ("on-complete"
#:to foo-logger
#:at 'debug ; NB: This is the default so it could be omitted
"time" (current-inexact-milliseconds))
(on-complete + 1 2 5))
(in/out-logged ("values"
#:at 'error ; NB: Goes to (current-logger) since #:to not given. Has 'error priority
#:with "time is: ~a, username is: ~a." (current-inexact-milliseconds) 'bob)
(values 1 2))
Produces:
foo: entering on-complete. args:
time 1631134220582.874
foo: in on-complete
foo: leaving on-complete. args:
time 1631134220582.874
8
entering values. time is: 1631134385090.149, username is: bob.
leaving values. time is: 1631134385090.161, username is: bob.
1
2
With thanks to Martin DeMello and Sorawee Porncharoenwase for suggestions on syntax and functionality.
TODO: Better formatting of the arguments.
(in/out-logged ("name" #:to foo-logger #:at 'info #:with "args are: ~a ~a" 'arg1 'arg2) code ...)