(def (get-caller cont)
  (let lp ((cont cont))
    (and cont
         (or (##continuation-creator cont)
             (lp (##continuation-next-frame cont #f))))))

(def (log/caller fmt . args)
  (continuation-capture
   (lambda (cont)
     (let (caller (get-caller cont))
       (when caller
         (display (or (##procedure-friendly-name caller) '?))
         (display ": "))
       (apply printf fmt args)))))

(def (foo)
  (log/caller "hello world~n")
  (void)) ; inhibit tail context

> (foo)
foo: hello world