Skip to content

Commit 6c5703a

Browse files
committed
Do a little README makeover
1 parent ff0bbbe commit 6c5703a

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

README.md

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,69 @@
1-
# sentry
1+
# Sentry
22

33
![Build Status](https://github.com/getsentry/sentry-elixir/actions/workflows/main.yml/badge.svg)
44
[![Hex Package](https://img.shields.io/hexpm/v/sentry.svg)](https://hex.pm/packages/sentry)
55
[![Hex Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/sentry)
66

7-
The official Sentry client for Elixir which provides a simple API to capture exceptions, automatically handle Plug exceptions, and provides a backend for the Elixir Logger. This documentation represents unreleased features, for documentation on the current release, see [here](https://hexdocs.pm/sentry/readme.html).
7+
The official Sentry client for Elixir which provides a simple API to capture exceptions, automatically handle Plug exceptions, and provides a backend for the Elixir Logger.
8+
9+
💁: This README documents unreleased features (from the `master` branch). For documentation on the current release, see [the official documentation][docs].
810

911
## Installation
1012

11-
To use Sentry with your projects, edit your mix.exs file and add it as a dependency. Sentry does not install a JSON library nor HTTP client by itself. Sentry will default to trying to use Jason for JSON operations and Hackney for HTTP requests, but can be configured to use other ones. To use the default ones, do:
13+
To use Sentry in your project, add it as a dependency in your `mix.exs` file. Sentry does not install a JSON library nor HTTP client by itself. Sentry will default to trying to use [Jason] for JSON serialization and [Hackney] for HTTP requests, but can be configured to use other ones. To use the default ones, do:
1214

1315
```elixir
1416
defp deps do
1517
[
1618
# ...
19+
1720
{:sentry, "8.0.0"},
18-
{:jason, "~> 1.1"},
19-
{:hackney, "~> 1.8"},
20-
# if you are using plug_cowboy
21-
{:plug_cowboy, "~> 2.3"},
21+
{:jason, "~> 1.4"},
22+
{:hackney, "~> 1.19"}
2223
]
2324
end
2425
```
2526

27+
## Usage
28+
29+
This is a short overview of how to use the library. For complete documentation, refer to [HexDocs][docs].
30+
2631
### Capture Crashed Process Exceptions
2732

28-
This library comes with an extension to capture all error messages that the Plug handler might not. This is based on [Logger.Backend](https://hexdocs.pm/logger/Logger.html#module-backends). You can add it as a backend when your application starts:
33+
This library comes with a [`:logger` handler][logger-handlers] to capture error messages coming from process crashes. To enable this, add the handler when your application starts:
2934

3035
```diff
31-
# lib/my_app/application.ex
36+
def start(_type, _args) do
37+
+ :logger.add_handler(:sentry_handler, Sentry.LoggerHandler, %{})
3238

33-
+ def start(_type, _args) do
34-
+ Logger.add_backend(Sentry.LoggerBackend)
39+
# ...
40+
end
3541
```
3642

37-
The backend can also be configured to capture Logger metadata, which is detailed [here](https://hexdocs.pm/sentry/Sentry.LoggerBackend.html).
43+
The handler can also be configured to capture `Logger` metadata. See the documentation [here](https://hexdocs.pm/sentry/Sentry.LoggerBackend.html).
3844

3945
### Capture Arbitrary Exceptions
4046

41-
Sometimes you want to capture specific exceptions. To do so, use `Sentry.capture_exception/2`.
47+
Sometimes you want to capture specific exceptions manually. To do so, use [`Sentry.capture_exception/2`](https://hexdocs.pm/sentry/Sentry.html#capture_exception/2).
4248

4349
```elixir
4450
try do
4551
ThisWillError.really()
4652
rescue
4753
my_exception ->
48-
Sentry.capture_exception(my_exception, [stacktrace: __STACKTRACE__, extra: %{extra: information}])
54+
Sentry.capture_exception(my_exception, stacktrace: __STACKTRACE__)
4955
end
5056
```
5157

5258
### Capture Non-Exception Events
5359

54-
Sometimes you want to capture messages that are not Exceptions.
60+
Sometimes you want to capture **messages** that are not exceptions. To do that, use [`Sentry.capture_message/2`](https://hexdocs.pm/sentry/Sentry.html#capture_exception/2):
5561

5662
```elixir
57-
Sentry.capture_message("custom_event_name", extra: %{extra: information})
63+
Sentry.capture_message("custom_event_name", extra: %{extra: information})
5864
```
5965

60-
For optional settings check the [docs](https://hexdocs.pm/sentry/readme.html).
66+
For optional settings check the [documentation][docs].
6167

6268
## Configuration
6369

@@ -189,3 +195,8 @@ When testing, you will also want to set the `send_result` type to `:sync`, so th
189195
## License
190196

191197
This project is Licensed under the [MIT License](https://github.com/getsentry/sentry-elixir/blob/master/LICENSE).
198+
199+
[Jason]: https://github.com/michalmuskala/jason
200+
[Hackney]: https://github.com/benoitc/hackney
201+
[docs]: https://hexdocs.pm/sentry/readme.html
202+
[logger-handlers]: https://www.erlang.org/doc/apps/kernel/logger_chapter#handlers

0 commit comments

Comments
 (0)