Set Logger level to :info in prod
[akkoma] / lib / pleroma / application.ex
index 5b6e233a683be53d139c61ae08611d12ea571603..f47cb0ce97e4f495c2300b74712e640b65f24823 100644 (file)
@@ -5,6 +5,7 @@
 defmodule Pleroma.Application do
   import Cachex.Spec
   use Application
+  require Logger
 
   @name Mix.Project.config()[:name]
   @version Mix.Project.config()[:version]
@@ -68,23 +69,22 @@ defmodule Pleroma.Application do
     Supervisor.start_link(children, opts)
   end
 
-  def load_custom_modules() do
-    dir = Pleroma.Config.get([:instance, :custom_modules_dir])
+  def load_custom_modules do
+    dir = Pleroma.Config.get([:modules, :runtime_dir])
 
     if dir && File.exists?(dir) do
       dir
-      |> File.ls!()
-      |> Enum.map(&Path.join(dir, &1))
-      |> Kernel.ParallelCompiler.compile()
+      |> Pleroma.Utils.compile_dir()
       |> case do
         {:error, _errors, _warnings} ->
           raise "Invalid custom modules"
 
         {:ok, modules, _warnings} ->
-          Enum.each(modules, fn mod ->
-            name = mod |> Atom.to_string() |> String.trim_leading("Elixir.")
-            IO.puts("Custom module loaded: #{name}")
-          end)
+          if @env != :test do
+            Enum.each(modules, fn mod ->
+              Logger.info("Custom module loaded: #{inspect(mod)}")
+            end)
+          end
 
           :ok
       end