LifeCycleHook - a hook that logging life-cycle of Phoenix LiveView

LifeCycleHook is a hook that logs the life-cycle of Phoenix LiveView.

By mounting LifeCycleHook on LiveView with use LifeCycleHook , you can see logs for each life-cycle of LiveView.

defmodule MyApp.MyLive do
  use Phoenix.LiveView
  use LifeCycleHook # mount LifeCycleHook

  @impl true
  def render(assigns) do
[debug] Elixir.MyApp.MyLive mount/3 with HTTP
[debug] Elixir.MyApp.MyLive handle_params/3 with HTTP
[debug] Elixir.MyApp.MyLive mount/3 with WebSocket
[debug] Elixir.MyApp.MyLive handle_params/3 with WebSocket

This library is made for education.


I need to solve the issue below to improve this library.

Now it supports all stages of Phoenix LiveView; mount, handle_params, handle_event, handle_info.

I’m going to improve the log messages and make it support custom message functions.

1 Like