Timber v2.0.0-rc1 Timber.HTTPClient behaviour
Behavior for custom HTTP clients. If you opt not to use the default Timber HTTP client
(Timber.HTTPClients.Hackney
) you can define your own by adhering to this behavior.
Example
defmodule MyHTTPClient do
alias Timber.HTTPClient
@behaviour HTTPClient
@spec request(HTTPClient.method, HTTPClient.url, HTTPClient.headers, HTTPClient.body, HTTPClient.options) ::
{:ok, HTTPClient.status, HTTPClient.Headers, HTTPClient.body} | {:error, any()}
def request(method, url, headers, body, opts) do
# make request here
end
end
Then specify it in your configuration:
config :timber, :http_client, MyHTTPClient