Where should logger backend app be added as a dependency in an umbrella app?

I have an Elixir umbrella application. The applications under the umbrella use Logger. I want to add a backend (logger_logstash_backend) for :logger application. So, I need to add that as a dependency in deps function in mix file.

In the outermost mix file of the umbrella application, the documentation of deps function states:

Dependencies listed here are available only for this project
and cannot be accessed from applications inside the apps folder

That means I have to add the backend module as a dependency for each of the applications under the umbrella. However, doing so causes several problems:

  1. It becomes harder to move out the individual applications as separate libraries later.

  2. The individual applications under the umbrella are not actually dependent on the custom :logger backend module. They’re okay with default :console backend. But I want to have an additional backend only for prod environment. Therefore, it’s more of a cross-applications concern where I’m forced to add the dependency to each application individually.

Do you know any better strategy? What is it?

2 Likes