While cleaning up a Phoenix project I noticed that Logger is being required in practically every single used module and component individually, and I had the idea of moving it into the shared definitions, e.g.
def live_component do quote do use Phoenix.LiveComponent use Phoenix.HTML # ... require Logger end end
Of course, I wondered why this wasn’t already the case - I researched if there was a reason and the only information I could find was the moduledoc mentioning this:
The definitions below will be executed for every controller, component, etc, so keep them short and clean, focused on imports, uses and aliases.
Are there any practical or theoretical downsides to requiring it there?