Logging with Telemetry in Elixir to Reduce Duplication

7
clicks
Logging with Telemetry in Elixir to Reduce Duplication

Source: elixirstreams.com

Type: Video

This article explains how to improve logging in an Elixir application that uses telemetry by consolidating logging calls. Instead of having log statements alongside telemetry executions in your event handlers (like 'increase' and 'decrease' for a counter), you can set up telemetry handlers to handle logging centrally. By doing so, you eliminate redundant Logger.info calls in your event functions. The provided code demonstrates how to implement this by defining a Logger module that attaches to the telemetry events and handles logging instead, streamlining your code and improving maintainability.

© HashMerge 2025