Pitcher
Pitcher is an Elixir Logger backend used to send logs to a custom REST endpoint.
Options
- url: The URL, including protocol, domain, port and path to send the logs
- method: An atom used to denote the method to use (:post, :put, :get etc.)
- opts: A list of options as per the HTTPoison dependency
- headers: A list of headers as per the HTTPoison dependency
- format: The logging format of the message. (defaults to
[$level] $message\n) - level: The minimum level to log. (defaults to
:debug) - metadata: Additional fields to be sent to the logs. These are merged with the default metadata
- metadata_filter: Sends only those metadata fields that are in the filter (all are sent if filter is not set)
Installation
Simply add to your mix.exs file as a dependency:
def deps do
[{:pitcher_logger_backend, "~> 0.0.1"}]
end
Then run mix deps.get to install it.
Configuration
config :logger,
backends: [{Logger.Backend.Pitcher, :my_error_log}, :console]
config :logger, :my_error_log,
url: "https://mydomain.com/logs",
method: :put,
level: :error,
format: "[$level] $message\n"