# ExCut aka CrossCut

<div align="center" style="margin-top:10px;">
  <img src="assets/ex_cut.png"/>

[![Hex version]( "Hex version")](
[![Hex downloads]( "Hex downloads")](
[![Build Status](](

## Motivation

  ExCut defines an annotation construct that wraps a regular function and enable
  it to be decorated with a cross-cutting concern. This provide a clean mechanism
  to inject reusable behavior without cluttering your code base.

## Documentation


## Examples

[ExCut Examples](

## Installation

  Add the following dependencies to your Elixir project

  def deps do
      {:ex_cut , "~> 0.1.0"}

## Using

  Let's take a look at ExCut in action to add logging behavior to a set of

  defmodule Logging do
    use ExCut, marker: :log, pre: :pre, post: :post

    require Logger

    @log level: :warn
    def elvis(a, b) when is_boolean(a), do: b

    @log level: :debug
    def elvis(a, b) when is_atom(a), do: "#{a}--#{b}"

    @log level: :info
    def elvis(a, b), do: a + b

    defp pre(c)       , do: "> #{}(#{c.args |> inspect})" |> log(c)
    defp post(c, _, r), do: "< #{} -> #{r}"               |> log(c)

    defp log(m, ctx) do
      |> case do
        :warn  -> m |> Logger.warn
        :debug -> m |> Logger.debug
        _      -> m |>

  ExCut provisions an `ExCut.Context` with call details and metadata
  that comes from the annotation. You can leverage this information in
  your cross-cutting functions.

<img src="assets/imhoteplogo.png" width="32" height="auto"/> © 2017 Imhotep Software LLC.
All materials licensed under [Apache v2.0](