Skip to content

Commit

Permalink
Enable web console logger for new projects
Browse files Browse the repository at this point in the history
  • Loading branch information
ponychicken committed Aug 25, 2024
1 parent 8f2770e commit 605d5a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions installer/templates/phx_assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ import "phoenix_html"
<%= @live_comment %>window.addEventListener("phx:page-loading-start", _info => topbar.show(300))
<%= @live_comment %>window.addEventListener("phx:page-loading-stop", _info => topbar.hide())

// Enable server log streaming to client.
<%= @live_comment %>window.addEventListener("phx:live_reload:attached", ({detail: reloader}) => {
<%= @live_comment %> reloader.enableServerLogs()
<%= @live_comment %> window.liveReloader = reloader
<%= @live_comment %>})


// connect if there are any LiveViews on the page
<%= @live_comment %>liveSocket.connect()

Expand Down
1 change: 1 addition & 0 deletions installer/templates/phx_single/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ config :<%= @app_name %>, <%= @endpoint_module %>,
# Watch static and templates for browser reloading.
config :<%= @app_name %>, <%= @endpoint_module %>,
live_reload: [
web_console_logger: true,
patterns: [
~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",<%= if @gettext do %>
~r"priv/gettext/.*(po)$",<% end %>
Expand Down

0 comments on commit 605d5a2

Please sign in to comment.