File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 231231 ([session key xform x] (spy> x session key xform)))
232232
233233(macros/deftime
234-
235234 (defmacro locals
236235 " Creates and returns a local environment map at the call site.
237236 A local environment map is a map of keyword representing each local name
255254 ([session key xform]
256255 `(spy> (locals ) ~session ~key ~xform)))
257256
257+ (defmacro expr
258+ " A simplified version of spy>>. Same as (spy>> '<expr> <expr>)."
259+ {:added " 0.5.3" }
260+ ([e] `(expr ~e identity))
261+ ([e xform] `(expr (current-session ) ~e ~xform))
262+ ([session e xform] `(spy> ~e ~session '~e ~xform)))
263+
258264 )
259265
260266(defn make-logger
277283
278284(defn make-multi-logger
279285 " Creates a multi logger.
280-
286+
281287 A multi logger is a variant of the simple logger. If called with
282288 two arguments, it acts like `(spy>> <arg1> <arg2>)` on the implicit
283289 session. If called with one argument, it acts like (log-for <arg>)`.
Original file line number Diff line number Diff line change 8787 (is (= {} (pm/logs )))
8888 (is (= {} (pm/stats ))))
8989
90+ (deftest ^:eftest/synchronized expr-test
91+ (is (= 15
92+ (loop [i 5 , sum 0 ]
93+ (if (zero? i)
94+ sum
95+ (recur (dec i) (pm/expr (+ i sum)))))))
96+ (is (= [5 9 12 14 15 ]
97+ (pm/log-for '(+ i sum))))
98+ (pm/reset! ))
99+
90100; ; Assert this function definition compiles
91101; ; cf. https://github.com/athos/postmortem/issues/2
92102(defn regression-2 [^long x]
You can’t perform that action at this time.
0 commit comments