1
- defmodule LogflareEx .Client do
1
+ defmodule WarehouseEx .Client do
2
2
@ moduledoc """
3
- A `LogflareEx .Client` contains all configuration used for making API requests, whether batched or not.
3
+ A `WarehouseEx .Client` contains all configuration used for making API requests, whether batched or not.
4
4
5
5
### Application-level Configuration
6
6
7
7
Application-wide configuration can be set in `config.exs`:
8
8
9
9
```elixir
10
- config :logflare_ex ,
10
+ config :warehouse_ex ,
11
11
api_key: "...",
12
12
source_token: "..."
13
13
```
14
14
15
15
### Runtime Configuration
16
16
17
- All configuration options can be overridden at runtime. This is through the use of the `LogflareEx .Client` struct.
17
+ All configuration options can be overridden at runtime. This is through the use of the `WarehouseEx .Client` struct.
18
18
19
- To create a new client with a custom configuration, use `LogflareEx .client/1`:
19
+ To create a new client with a custom configuration, use `WarehouseEx .client/1`:
20
20
21
21
```elixir
22
22
# To create a client from the application-level configuration.
23
- iex> default_client = LogflareEx .client()
24
- %LogflareEx .Client{...}
23
+ iex> default_client = WarehouseEx .client()
24
+ %WarehouseEx .Client{...}
25
25
26
26
# To create a client with runtime overrides
27
- iex> client = LogflareEx .client(source_token: "...")
28
- %LogflareEx .Client{...}
27
+ iex> client = WarehouseEx .client(source_token: "...")
28
+ %WarehouseEx .Client{...}
29
29
30
30
# use the runtime client
31
- iex> LogflareEx .send_batched_event(client, %{...})
31
+ iex> WarehouseEx .send_batched_event(client, %{...})
32
32
:ok
33
33
```
34
34
@@ -37,17 +37,17 @@ defmodule LogflareEx.Client do
37
37
For every configuration, either `:source_token` or `:source_name` must be provided.
38
38
39
39
- `:api_key`: **Required**. Public API key.
40
- - `:api_url`: Custom Logflare endpoint, for self-hosting. Defaults to `https//api.logflare.app`.
40
+ - `:api_url`: Custom server endpoint, for self-hosting. Defaults to `https//api.logflare.app`.
41
41
- `:source_token`: Source UUID. Mutually exclusive with `:source_name`
42
42
- `:source_name`: Source name. Mutually exclusive with `:source_token`
43
43
- `:on_error`: mfa callback for handling API errors. Must be 1 arity.
44
44
- `:on_prepare_payload`: mfa callback or anonymous function for preparing the final payload before sending to API. Must be 1 arity.
45
- - `:auto_flush`: Used for batching. Enables automatic flushing. If disabled, `LogflareEx .flush/1` must be called.
45
+ - `:auto_flush`: Used for batching. Enables automatic flushing. If disabled, `WarehouseEx .flush/1` must be called.
46
46
- `:flush_interval`: Used for batching. Flushes cached events at the provided interval.
47
47
- `:batch_size`: Used for batching. It is the maximum number of events send per API request.
48
48
49
49
"""
50
- @ default_tesla_adapter { Tesla.Adapter.Finch , name: LogflareEx .Finch, receive_timeout: 30_000 }
50
+ @ default_tesla_adapter { Tesla.Adapter.Finch , name: WarehouseEx .Finch, receive_timeout: 30_000 }
51
51
@ default_batch_size 250
52
52
@ default_flush_interval 1_500
53
53
@@ -116,7 +116,7 @@ defmodule LogflareEx.Client do
116
116
end
117
117
118
118
def get_config_value ( key ) do
119
- Application . get_env ( :logflare_ex , key )
119
+ Application . get_env ( :warehouse_ex , key )
120
120
end
121
121
122
122
def validate_client ( % __MODULE__ { source_name: nil , source_token: nil } ) ,
0 commit comments