Skip to content

Commit

Permalink
Render the value in-thread before sending off in order to always prin…
Browse files Browse the repository at this point in the history
…t mutable values correctly
  • Loading branch information
bendlas authored and dgrnbrg committed Nov 13, 2012
1 parent 735e1d4 commit 80781e9
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/spyscope/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,18 @@
"Reader function to store detailed information about a form's value at runtime
into a trace that can be queried asynchronously."
[form]
`(let [f# ~form]
`(let [f# ~form
value# (pretty-render-value f#
~(assoc (meta form)
::form (list 'quote form)))]
(send-off trace-storage
(fn [{g# :generation t# :trace :as storage#}]
(let [value# (pretty-render-value
f#
~(assoc (meta form)
::form (list 'quote form)))]
(when ~(::print? (meta form))
(println (:message value#)))
(assoc storage#
:trace
(conj t# (assoc value#
:generation g#))))))
(fn [{g# :generation t# :trace :as storage#}]
(when ~(::print? (meta form))
(println (:message value#)))
(assoc storage#
:trace
(conj t# (assoc value#
:generation g#)))))
f#))

(defn print-log-detailed
Expand Down

0 comments on commit 80781e9

Please sign in to comment.