LogflareEx (logflare_ex v0.1.1)

Documentation for LogflareEx.

Summary

Functions

Creates a client for interacting with Logflare.

Send a singular event to Logflare.

Functions

Creates a client for interacting with Logflare.

Options:

  • :api_key, required - api key obtained from dashboard
  • :api_url, optional - Logflare instance url, defaults to Logflare service at https://api.logflare.app
  • :source_token, required for ingest - A source uuid obtained from dashboard
  • :adapter, optional - Tesla client adapter

Examples

iex> LogflareEx.client(%{...})
%LogflareEx.Client{...}
Link to this function

send_event(client, event)

@spec send_event(LogflareEx.Client.t(), map()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Send a singular event to Logflare.

Example

Pipe the client into the desired function

iex> client |> LogflareEx.send_event(%{my: "event"})
{:ok, %{"message"=> "Logged!}}

If an error is encountered, the tesla result will be returned
iex> client |> LogflareEx.send_event(%{my: "event"})
{:error, %Tesla.Env{...}}
Link to this function

send_events(client, batch)

@spec send_events(LogflareEx.Client.t(), [map()]) ::
  {:ok, map()} | {:error, Tesla.Env.t()}