https://github.com/mgwidmann/flames
Real time error monitoring for Phoenix and Elixir applications.
https://github.com/mgwidmann/flames
Last synced: 4 months ago
JSON representation
Real time error monitoring for Phoenix and Elixir applications.
- Host: GitHub
- URL: https://github.com/mgwidmann/flames
- Owner: mgwidmann
- Created: 2016-06-14T12:53:46.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-08T01:02:05.000Z (over 2 years ago)
- Last Synced: 2024-04-14T20:20:05.929Z (about 2 years ago)
- Language: Elixir
- Homepage:
- Size: 2.38 MB
- Stars: 38
- Watchers: 4
- Forks: 3
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flames [](https://hex.pm/packages/flames) [](https://semaphoreci.com/mgwidmann/flames)

## Installation
The package can be installed as:
1. Add `flames` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:flames, "~> 0.7"}]
end
```
2. Add configuration to tell `flames` what your repository and (optional) Phoenix Endpoint modules are as well as adding it as a Logger backend:
```elixir
config :flames,
repo: MyPhoenixApp.Repo,
endpoint: MyPhoenixApp.Endpoint,
timezone: "America/New_York",
table: "errors" # Optional, defaults to "errors"
config :logger,
backends: [:console, Flames.Logger]
```
3. Add the following migration. Run `mix ecto.gen.migration create_flames_table` to generate a migration file:
```elixir
defmodule MyApp.Repo.Migrations.CreateFlamesTable do
use Ecto.Migration
def change do
# Make sure this table name matches the above configuration
create table(:errors) do
add :message, :text
add :level, :string
add :timestamp, :utc_datetime
add :alive, :boolean
add :module, :string
add :function, :string
add :file, :string
add :line, :integer
add :count, :integer
add :hash, :string
add :incidents, :json
timestamps()
end
create index(:errors, [:hash])
create index(:errors, [:updated_at])
end
end
```
Run `mix ecto.migrate` to migrate the database.
4. Add `import Flames.Router` and `flames "/errors"` to your Phoenix Router for live updates:
Router (You should place this under a secure pipeline and secure it yourself)
```elixir
defmodule MyAppWeb.Router do
use Phoenix.Router
import Flames.Router # <--- Add this here
scope "/admin", MyAppWeb do
# Define require_admin plug to ensure public users cannot get here
pipe_through [:browser, :require_admin]
flames "/errors" # <--- Add this here
end
end
```
Visit http://localhost:4000/errors (or wherever you mounted it) to see a live stream of errors.