Enabling Server Log Streaming to Browser Console in Elixir

259
clicks
Enabling Server Log Streaming to Browser Console in Elixir

Source: elixirstreams.com

Type: Video

The article introduces a new feature available in the `phoenix_live_reload` 1.5 release for Elixir applications. It demonstrates how, by making a minor update to the `config/dev.exs` and `app.js` files, developers can stream server logs to the browser's console, providing a convenient way to monitor server activity in real time during development. By adding a single line to the endpoint configuration (`web_console_logger: true`) and an event listener in the JavaScript file that calls `enableServerLogs` on the Phoenix live reloader object, developers can achieve this functionality with minimal setup.

© HashMerge 2024