Skip to content

Commit 2dec527

Browse files
committed
feat: Add tap> logging support fns
1 parent 08be109 commit 2dec527

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/inferenceql/query/log.cljc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,19 @@
77
[x]
88
(tap> #:spy{:x x})
99
x)
10+
11+
(defn log-tap
12+
"A tap that prns the value to the console. Use `(add-tap log-tap)` to add it."
13+
[x]
14+
(prn x)
15+
(println))
16+
17+
(defn clear-taps
18+
"Clears all taps.
19+
20+
This is primarily for removing anonymous tap fns. If you don't have a reference
21+
to the tap fn, you can't remove it. But if you do, prefer `remove-tap`."
22+
[]
23+
;; tapset is annoyingly private (and Clojure lacks this functionality), so we
24+
;; have to use intern to bypass that
25+
(intern 'clojure.core 'tapset (atom #{})))

0 commit comments

Comments
 (0)