I have the following in a file "constraint.clj" starting at line 49 (shown with line numbers):
49 (defn stacker []
50 (let [s (first (.getStackTrace (new java.lang.Throwable)))]
51 {:name (.getMethodName s)
52 :file (.getFileName s)
53 :line (.getLineNumber s)}))
54
55 (def s (stacker))
From nrepl, I compile the file. When I inspect the value at s, it shows.
app.constraint> s
{:name "invoke", :file "constraint.clj", :line 50}
So, basically, it seems to work pretty well, except that the getMethodName is not what I expected. I would like :name
to be app.constraint/stacker
. How do I do that?