An extension of clojure.contrib.trace
Clojure
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
resources/styles
src/fn
README.org
project.clj

README.org

fn.trace is an extension of clojure.contrib.trace

It adds the ability to trace functions in a multithreaded app (by sending the trace output of each thread to a separate file), and to report exceptions that were thrown.

To add to your project.clj

[fn.trace "1.3.2.0-SNAPSHOT"]

Usage

You can trace single functions or entire namespaces (all public fns in that namespace).

(use 'fn.trace)
(dotrace-all [my.ns1 
              my.ns2 
              my.other.ns1/fn1]}
  (my.ns1/fn1 arg1 arg2)
  (my.ns2/fn5 blah blah blah)
  (comment "etc, etc"))

You can also exclude fns from a traced namespace as follows:

(use 'fn.trace)
(dotrace (remove #{'my.ns1/verbose-fn1 'my.ns2/other-unwanted-fn1} 
                 (all-fns [my.ns1 
                           my.ns2 
                           my.other.ns1/fn1]}
  (my.ns1/fn1 arg1 arg2)
  (my.ns2/fn5 blah blah blah)
  (comment "etc, etc"))

Trace multithreaded:

(use 'fn.trace)
;;this code should be located somewhere where each thread you want to
;;trace will hit it
(binding [tracer (per-thread-tracer)] 
 (dotrace (remove ['my.ns1/verbose-fn1 'my.ns2/other-unwanted-fn1] 
                  (all-fns [my.ns1 
                            my.ns2 
                            my.other.ns1/fn1]}
   (my.ns1/fn1 arg1 arg2)
   (my.ns2/fn5 blah blah blah)
   (comment "etc, etc")))