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:
def deps do
[
{:blabbermouth, "~> 0.1.0"}
]
endAdd Blabbermouth to your application as a child:
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:
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 toBlabbermouth.Log. Valid parameters areBlabbermouth.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
Blabbermouth.Log
Calls Logger.log and is configurable with a host of options:
:log_level: either aLogger.level()or:random, in which case aLogger.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.