⚡️ Stream Server Logs to Console!

If you recently upgraded to phoenix_live_reload 1.5 without looking at the changelog you may have missed an awesome update.

With a small change to two files, we can stream our server logs directly to our browser’s console!

In config/dev.exs:

 # config/dev
  config :my_app, MyAppWeb.Endpoint,
    live_reload: [
      interval: 1000,
      patterns: [...],
+     web_console_logger: true

In app.js:

+ window.addEventListener("phx:live_reload:attached", ({detail: reloader}) => {
+   // enable server log streaming to client.
+   // disable with reloader.disableServerLogs()
+   reloader.enableServerLogs()
+ })

And you’re all set!

Relaunch your server and watch the magic happen. ✨

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.