MRdotB

MRdotB

DiscoLog - Use Discord as a logging service and error tracking solution

Hello,

I’m excited to introduce DiscoLog, a logging service and error tracking solution for Elixir that uses a Discord server as its backend.

Setup

DiscoLog is easy to set up with a mix task that creates three channels for you:

  • #occurrences: A forum-style channel where errors are grouped by fingerprint and tagged, making it easy to track and manage them.
  • #info: This channel pipes the output of Logger.info directly to Discord, keeping you informed of general application events.
  • #error: This channel pipes the output of Logger.error. If the logger content is not an exception, it goes here; otherwise, it’s routed to #occurrences.

Additionally, DiscoLog have integration with Plug, Phoenix, LiveView, and Oban to provide extra context through :telemetry

Additionally, DiscoLog includes a :logger handler that converts exceptions into error occurrences, even for processes that lack specific integrations, such as GenServer crashes.

By using Discord, DiscoLog benefits from built-in notifications through the Discord app. Another advantage of the forum channel is the ability to prevent specific errors from triggering notifications repeatedly.

The Story Behind DiscoLog

DiscoLog is built upon the foundations of error_tracker, for the :logger handler, I borrows a lot of code from sentry-elixir and appsignal-elixir

The idea for DiscoLog emerged while experimenting with Discord’s Bot API. I realized that the Discord Forum Channel type could serve as a good solution for error tracking. The primary challenge was Discord’s limited message size, but I overcame this by utilizing message attachments to handle larger payloads.

Most Liked

MRdotB

MRdotB

:rocket: v1.0.0 Released!
I’m excited to announce the release of DiscoLog v1.0.0! This update introduces two optional features:

  • Presence Status – Allows your bot to appear online, representing your node in Discord.
  • Go To Repo – Provides a direct link to GitHub (or a similar platform) to check the code where an error was triggered.

Additionally, it’s now possible to use the Discord client for ad hoc usage, though examples are not yet available.

:movie_camera: New Demo: I’ve created a YouTube video showcasing the Presence Status and Go To Repo features

:pray: Huge thanks to @martosaur for implementing the Presence Status feature and refactoring the code to support ad hoc usage

MRdotB

MRdotB

I released disco_log v0.5.1:

  • it fixes an issue that was crashing the logger handler because some elixir type can’t be serialized as is

Meanwhile I have been using it in production on multiples side projects.
I’m very satisfied with the error tracking ! :slight_smile:

Next features on my list are:

  • Go to code the idea is to be able to click the occurrence and to go to the relevant github code on the specfic branch / tag
  • Active presence message to make the bot display some info about the node
dimitarvp

dimitarvp

Wow that’s amazing, thanks for putting it together!

MRdotB

MRdotB

I’m not sure what value integrating with Tower brings. DiscoLog already has a logger handler, so after configuring the Logger backend, doing Logger.error(some_exception) reports the error to the Discord backend. For telemetry, I also hook them and report separately. Adding DiscoLog to your app only requires modifying the config, with no additional code changes. Additionally, we have duplicate logic in event.ex, which I need for error tracking.

martosaur

martosaur

I’ve only started using it but it’s been great so far. I like how setting up logging for multiple projects/environment is a matter of configuring category_id/channel_id.

I think I may have preferred starting DiscoLog under the application’s supervision tree and explicitly configuring logger handlers, but it might be too early to say :thinking:

Where Next?

Popular in Libraries Top

scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
mhanberg
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix! You can read this blog post or the docs for more info...
New
marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New
pkrawat1
Presenting Aviacommerce, open source e-commerce platform in Elixir Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
aditya7iyengar
Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections. Fo...
New
Crowdhailer
I have been updating a library that allows you to pipe between functions that use the erlang result tuple convention. Assuming you have...
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
381 12391 119
New

Other popular topics Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New

Sub Categories:

We're in Beta

About us Mission Statement