Enhancing Developer Experience with Server Logs in the Browser Console

226
clicks
Enhancing Developer Experience with Server Logs in the Browser Console
Fly.io, known for turning containers into VMs, has introduced a feature that streams server logs to the browser console, enhancing the development workflow. The `phoenix_live_reload` utility, which has been part of Phoenix since its inception, allows for live code reloading in development. Capitalizing on this feature, the latest update involves sending server logs to the client's browser, simplifying the debugging process by congregating client and server logs in one place. By adding a custom Erlang log handler and utilizing Elixir's Registry for pubsub-like behavior, developers can have server logs displayed alongside client-side logs in the web console. This feature, part of the 'phoenix_live_reload' 1.5 release, enables developers to have an integrated debugging experience, minimizing the need to context-switch between terminal logs and browser tools during development. To utilize this feature, developers can enable the `web_console_logger` in their `config/dev.exs` and add simple code setup in `assets/js/app.js` to achieve a 'dev bliss' with more efficient troubleshooting.

© HashMerge 2024