Skip to content

weissjeffm/fn.trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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")))

About

An extension of clojure.contrib.trace

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published