phoenixframework / phoenix

Peace of mind from prototype to production
https://www.phoenixframework.org
MIT License
21.46k stars 2.88k forks source link

Enable web console logger for new projects #5910

Closed ponychicken closed 5 hours ago

ponychicken commented 3 months ago

This article describes a new and useful feature in Live reload 1.5 and later. I think it could make sense to enable it by default for new projects...

https://fly.io/phoenix-files/phoenix-dev-blog-server-logs-in-the-browser-console/

SteffenDE commented 3 months ago

Thank you, @ponychicken! I think we'll need to add web_console_logger: true here as well:

https://github.com/phoenixframework/phoenix/blob/010a73848d6e11948f91d8c6960cbf7806960ccf/installer/templates/phx_single/config/dev.exs#L47

config :my_app, MyAppWeb.Endpoint,
  live_reload: [
+   web_console_logger: true,
    patterns: [
      ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"priv/gettext/.*(po)$",
      ~r"lib/my_app_web/(controllers|live|components)/.*(ex|heex)$"
    ]
  ]
ponychicken commented 1 month ago

@SteffenDE I think you meant the file installer/templates/phx_umbrella/apps/app_name_web/config/dev.exs right?

I pushed it.

SteffenDE commented 5 hours ago

Thank you! 🙌

josevalim commented 4 hours ago

You had to revert it? Any particular reason?

SteffenDE commented 4 hours ago

I didn't see https://github.com/phoenixframework/phoenix/pull/5799 which also added a comment for the click to open functionality, so I went with that one instead.

josevalim commented 4 hours ago

Should we have it enabled by default in dev?

SteffenDE commented 4 hours ago

It is probably the better developer experience, so yeah, I think I'd be happy with doing it by default. I can send a PR :)