Fork me on GitHub
#portal
<
2023-05-08
>
James Pratt16:05:15

Hi, I think I remember seeing a macro somewhere in one of the clojure libraries in the main distribution or in portal itself that: 1. tap> s a value but then returns the tapped value instead of true, so that I can enclose any form in the macro and not affect code function. 2. also logs the form itself as well as the returned value and/or the line number, file name where the tap> happens and more. In the same library there were macros for tapping threaded expressions as well I think. Am I misremembering or can someone point me to the macro(s). J

James Pratt16:05:29

Ah, looking at portal.console now.

👍 2
James Pratt16:05:57

just what I was looking for 🙂

James Pratt17:05:23

thanks a lot for the great work @U1G869VNV

seancorfield17:05:48

FWIW (doto tap>) in a -> pipeline will do what you want:

(-> expr
    (doto tap>) ; tap expr
    (process) ; process expr
    (doto tap>)) ; tap result

❤️ 2
seancorfield17:05:16

(although that won't handle exceptions the same way portal.console/log does)

James Pratt21:05:13

oh, that's handy thanks @U04V70XH6