README.md

# Blabbermouth

A library for generating lots of logs.

## Installation

The package can be installed by adding `blabbermouth` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:blabbermouth, "~> 0.1.0"}
  ]
end
```

Add Blabbermouth to your application as a child:

```elixir
  children = [
    {BlabberMouth, [interval: :timer.seconds(1), opts: [log_level: :error, message: "I spam you!", metadata: [user_id: 123]]]},
    ...
  ]

```

You can also initialize several Blabbermouths with different intervals, messages, levels, etc.

To make this easier, use the `Blabbermouth.Gaggle` module, which supervises a collection of Blabbermouths:

```elixir
  children = [
    {Blabbermouth.Gaggle, [
      {Blabbermouth.Log, 5_000, log_level: :error},
      {Blabbermouth.Log, 1_000, log_level: :info}
    ]},
    ...
  ]
```

## Configuration

The following options are available to be passed to Blabbermouth:

* `:blabber` - the blabber that the Blabbermouth should use. Defaults to `Blabbermouth.Log`. Valid parameters are
  * `Blabbermouth.Log` - emits logs.
* `:interval` - the interval on which the blabber is triggered (i.e. a log emitted). Can be either an integer in milliseconds (`:timer.seconds(10)`) or in the form of a `{module, function, args}` tuple, like `{Enum, :random, [100..10_000]}`.
* `:opts` - options specific to the [Blabber](#blabbers). 

## Blabbers

### Blabbermouth.Log

Calls `Logger.log` and is configurable with a host of options:

* `:log_level`: either a `Logger.level()` or `:random`, in which case a `Logger.level()` is chosen at random with an equal distribution.
* `:message`: the message that should be printed. If not specified, a random message is printed.
* `:metadata`: The metadata that should be logged, as a Keyword list. If not specified, specifies an `:integer`, `:float`, `:string`, `:atom`, `:list`, `:tuple`, `:pid`, and `:ref`.