(install! f vars)
For every applicable var in vars - removes any existing wiretap and alters
the root binding to be a variadic function closing over the value g
of the
var and the user provided function f
.
A var is considered applicable if its metadata does not contain the key
:wiretap.wiretap/exclude
and its value implements Fn, i.e. is an object created viafn
.
When the resulting "wiretapped" function is called, a map representing the
context of the call is first passed to f
before the result is computed
by applying g
to to any args provided. f
is then called with an updated
context before the result is returned. In both cases, f
is executed within
a try/catch
on the same thread. The result of calling f
is discarded.
Returns a coll of all modified vars.
The following contextual data is will always be present in the map passed
to f
:
Key | Value |
---|---|
:id | Uniquely identifies the call. Same value for pre and post calls. |
:name | A symbol. Taken from the meta of the var. |
:ns | A namespace. Taken from the meta of the var. |
:function | The value that will be applied to the value of :args . |
:thread | The name of the thread. |
:stack | The current stacktrace. |
:depth | Number of wiretapped function calls on the stack. |
:args | The seq of args that value of :function will be applied to. |
:start | Nanoseconds since some fixed but arbitrary origin time. |
:parent | The context of the previous wiretapped function on the stack. |
If the wiretapped var is a multimethod then the following information will also be present.
Key | Value |
---|---|
:multimethod? | true |
:dispatch-val | The dispatch value used to select the method. |
When f
is called pre invocation the following information will also be present.
| Key | Value |
| ------- | -------|
| :pre?
| true
|
When f
is called post invocation the following information will also be present.
Key | Value |
---|---|
:post? | true |
:stop | Nanoseconds since some fixed but arbitrary origin time. |
:result | The result computed by applying the value of :function to the value of :args . |
:error | Any exception caught during computation of the result. |
For every applicable var in vars - removes any existing wiretap and alters the root binding to be a variadic function closing over the value `g` of the var and the user provided function `f`. > A var is considered applicable if its metadata does not contain the > key `:wiretap.wiretap/exclude` and its value implements Fn, i.e. is an > object created via `fn`. When the resulting "wiretapped" function is called, a map representing the **context** of the call is first passed to `f` before the result is computed by applying `g` to to any args provided. `f` is then called with an updated context before the result is returned. In both cases, `f` is executed within a `try/catch` on the same thread. The result of calling `f` is discarded. Returns a coll of all modified vars. The following contextual data is will **always** be present in the map passed to `f`: | Key | Value | | ----------- | ---------------------------------------------------------------- | | `:id` | Uniquely identifies the call. Same value for pre and post calls. | | `:name` | A symbol. Taken from the _meta_ of the var. | | `:ns` | A namespace. Taken from the _meta_ of the var. | | `:function` | The value that will be applied to the value of `:args`. | | `:thread` | The name of the thread. | | `:stack` | The current stacktrace. | | `:depth` | Number of _wiretapped_ function calls on the stack. | | `:args` | The seq of args that value of `:function` will be applied to. | | `:start` | Nanoseconds since some fixed but arbitrary origin time. | | `:parent` | The context of the previous wiretapped function on the stack. | ### Multimethods If the wiretapped var is a multimethod then the following information will also be present. | Key | Value | | ---------------- | --------------------------------------------- | | `:multimethod?` | `true` | | `:dispatch-val` | The dispatch value used to select the method. | ### Pre invocation When `f` is called **pre** invocation the following information will also be present. | Key | Value | | ------- | -------| | `:pre?` | `true` | ### Post invocation When `f` is called **post** invocation the following information will also be present. | Key | Value | | --------- | --------------------------------------------------------------------------------- | | `:post?` | `true` | | `:stop` | Nanoseconds since some fixed but arbitrary origin time. | | `:result` | The result computed by applying the value of `:function` to the value of `:args`. | | `:error` | Any exception caught during computation of the result. |
(uninstall!)
(uninstall! vars)
Uninstalls all wiretaps from all applicable vars in vars.
A var is considered applicable if the key :wiretap.wiretap/uninstall
is present in the metadata and the key :wiretap.wiretap/exclude
is not.
Returns a coll of all modified vars.
Uninstalls all wiretaps from all applicable vars in vars. A var is considered applicable if the key `:wiretap.wiretap/uninstall` is present in the metadata and the key `:wiretap.wiretap/exclude` is not. Returns a coll of all modified vars.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close