Are there any downsides to requiring Logger in shared definitions?

Hello everyone,

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

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?

It is fine. That note is mostly to avoid defining functions in the blocks. aliases, imports, and requires are fine!


Thank you!