### Copy Example Configuration Files Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/README.md Copy the example configuration files to your local environment for development and testing. ```bash cp config/dev.example.exs config/dev.exs cp config/test.example.exs config/test.exs ``` -------------------------------- ### Install and Build Project Assets Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/README.md Install and build the JavaScript and CSS assets required for the Web UI. This command should be run after initial setup or when updating dependencies. ```bash mix do assets.install, assets.build ``` -------------------------------- ### Start Development Server Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/README.md Start the development server using the provided dev.exs script, which is based on Phoenix Playground. ```bash iex dev.exs ``` -------------------------------- ### Install ErrorTracker after adding dependencies Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Run this command after adding `error_tracker` and `igniter` to your dependencies in `mix.exs`. ```bash mix error_tracker.install ``` -------------------------------- ### Install ErrorTracker using Igniter Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Use this command to automatically install and configure ErrorTracker if Igniter is already available in your project. ```bash mix igniter.install error_tracker ``` -------------------------------- ### Watch for Asset Changes Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/README.md Start the asset watcher to automatically recompile CSS when changes are made to Tailwind CSS classes. Run this in a separate terminal. ```bash mix assets.watch ``` -------------------------------- ### Integrate ErrorTracker with Phoenix Endpoint Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Include this integration in your `Phoenix.Endpoint` module to track errors that occur before the Phoenix router starts handling requests. ```elixir defmodule MyApp.Endpoint do use Phoenix.Endpoint use ErrorTracker.Integrations.Plug # Your code here end ``` -------------------------------- ### Download Project Dependencies Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/README.md Download all necessary project dependencies using Mix. ```bash mix deps.get ``` -------------------------------- ### Apply database migrations Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Execute this command to run all pending Ecto migrations, including the one for ErrorTracker. ```bash mix ecto.migrate ``` -------------------------------- ### Configure ErrorTracker settings Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Add these configuration options to your `config/config.exs` file to set the repository, OTP app, and enable/disable tracking. ```elixir config :error_tracker, repo: MyApp.Repo, otp_app: :my_app, enabled: true ``` -------------------------------- ### Add ErrorTracker and Igniter to dependencies Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Add these dependencies to your mix.exs file if the `igniter.install` escript is not available. Ensure to run `mix deps.get` afterwards. ```elixir {:error_tracker, "~> 0.9"}, {:igniter, "~> 0.5", only: [:dev]}, ``` -------------------------------- ### Generate Ecto migration for ErrorTracker Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Run this command to generate a new Ecto migration file for adding ErrorTracker's database tables. ```bash mix ecto.gen.migration add_error_tracker ``` -------------------------------- ### Declare ErrorTracker as a dependency Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Add this to your `mix.exs` file to include ErrorTracker as a project dependency. ```elixir # mix.exs defp deps do [ {:error_tracker, "~> 0.9"} ] end ``` -------------------------------- ### Integrate ErrorTracker with Plug Router Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Add this integration to your `Plug.Router` module if your application uses Plug but not Phoenix, to enable error tracking. ```elixir defmodule MyApp.Router do use Plug.Router use ErrorTracker.Integrations.Plug # Your code here end ``` -------------------------------- ### Manually Report Errors Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Use `ErrorTracker.report/2` to manually report an exception and its stack trace. This is useful for errors outside default integration scopes. ```elixir try do # your code catch e -> ErrorTracker.report(e, __STACKTRACE__) end ``` -------------------------------- ### Define ErrorTracker migration functions Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Implement the `up` and `down` functions in the generated migration file to manage ErrorTracker's database schema. ```elixir defmodule MyApp.Repo.Migrations.AddErrorTracker do use Ecto.Migration def up, do: ErrorTracker.Migration.up(version: 5) # We specify `version: 1` in `down`, to ensure we remove all migrations. def down, do: ErrorTracker.Migration.down(version: 1) end ``` -------------------------------- ### Set Custom Context for Errors Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Use `ErrorTracker.set_context/1` to add custom information, like a user ID, to errors occurring in the current process. This context is merged with default integrations. ```elixir ErrorTracker.set_context(%{user_id: conn.assigns.current_user.id}) ``` -------------------------------- ### Define Custom Error Ignoring Logic Source: https://github.com/elixir-error-tracker/error-tracker/blob/main/guides/Getting Started.md Implement the `ErrorTracker.Ignorer` behaviour to define custom logic for ignoring specific errors. This prevents ignored errors from being tracked. ```elixir defmodule MyApp.ErrorIgnores do @behaviour ErrorTracker.Ignorer @impl ErrorTracker.Ignorer def ignore?(%{kind: "Elixir.UnreliableThirdParty.Error", reason: ":timeout"} = _error, _context) do true end end ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.