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
...
end
end
[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