Interceptor.Annotated (interceptor v0.5.4) View Source
The Interceptor library allows you to intercept function calls, as you can see
in the Interceptor module documentation.
This module allows you to intercept your functions using @intercept true
"annotations", instead of having to use the Interceptor.intercept/1 macro.
This is how you can use the Interceptor.Annotated module on the example
Intercepted module (defined on the Interceptor module documentation):
defmodule Intercepted do
use Interceptor.Annotated
@intercept true
def abc(x), do: "Got #{inspect(x)}"
# the following function can't be intercepted
# because it doesn't have the `@intercept true` annotation
def not_intercepted(f, g, h), do: f+g+h
endThis way of intercepting the Intercepted.abc/1 function is equivalent to
the one using the Interceptor.intercept/1 macro described on the
Interceptor module documentation. Please check it for more information
on how to configure this library.
Note: If you want to override the interception configuration coming from the
application configuration file (i.e. config/config.exs) or you simply just
want to set the interception configuration on each intercepted module, you
can also pass the interception config when using the Interceptor.Annotated
module: use Interceptor.Annotated, config: My.Interception.Config.
Check the section Intercept configuration on the intercepted module on the
Interceptor module docs for more information.