I'd like to offer two functions of mine for inclusion in tools.trace,
recently brought back into my working memory by a comment on this old
Gist of mine:
https://gist.github.com/492764
trace-ns causes calls to all functions in a given namespace to print
out tracing info; untrace-ns restores the original functions. Both
seem to work fine with Clojure 1.3 and the current tools.trace.
The patch is attached. (It's the same code + a test.) I though I'd
postpone creating a JIRA ticket until after soliciting comments -- let
me know if I should have gone ahead and created it right away, I'm not
too clear on the current preferred workflow... Also, I hope it's ok to
send patches directly to the list.
Sincerely,
Michał
I looked at it and the code Don Jackson wrote.
I see value in this. Lets wait a week or so for comments and after I'll take
a shot at it and merge this to get another version out.
Has Don sent a CA ? I did not find his name in the list.
Luc P.
> > -- > You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
> To post to this group, send email to cloju...@googlegroups.com.
> To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.
> > --
Softaddicts<lprefo...@softaddicts.ca> sent by ibisMail!
Great!
> Has Don sent a CA ? I did not find his name in the list.
Wouldn't know, we could reach out to him on GitHub. I'll be replying
to his last comment on my Gist once I'm done with this message, so
I'll attach a link to this discussion and my new Gist (see below).
I have a new approach though which I like best ATM, mostly because of
how factored it came out to be -- one moderately complex function + a
bunch of one-liners of some utility. I need to read Don's code
properly to compare. Also, a switch to namespaced keywords would make
sense if this was to go into tools.trace... will do that later.
https://gist.github.com/1849273
If this seems interesting, I'll make the switch to namespaced
keywords, test this properly, try and take into accounts any comments,
maybe make a few tweaks and prepare a patch.
Sincerely,
Michał
Done.
> Also, a switch to namespaced keywords would make
> sense if this was to go into tools.trace... will do that later.
Done. Also fixed some bugs.
> If this seems interesting, I'll make the switch to namespaced
> keywords, test this properly, try and take into accounts any comments,
> maybe make a few tweaks and prepare a patch.
New patch attached.
Sincerely,
Michał
Sincerely,
Michał
Clojure 1.3.0
user=> (ns trace-ns-test.core)
nil
trace-ns-test.core=> (defn foo [] :foo)
#'trace-ns-test.core/foo
trace-ns-test.core=> (defn bar [] (foo))
#'trace-ns-test.core/bar
trace-ns-test.core=> (in-ns 'user)
#<Namespace user>
user=> (use 'clojure.tools.trace)
nil
user=> (trace-ns 'trace-ns-test.core)
nil
user=> (trace-ns-test.core/bar)
TRACE t136: (trace-ns-test.core/bar)
TRACE t137: | (trace-ns-test.core/foo)
TRACE t137: | => :foo
TRACE t136: => :foo
:foo
user=> (untrace-ns 'trace-ns-test.core)
nil
user=> (trace-ns-test.core/bar)
:foo
All the best,
Michał
s/old one/last one/
Thank you
Luc