I have a script which uses some libraries which seem to be running Logger in debug mode. First lines of my script:
#!/usr/bin/env -S ERL_FLAGS=+B elixir
Mix.install([{:req, "~> 0.5.0"},{:feeder_ex, "~> 1.1.0"},{:timex, "~> 3.7.0"},{:yaml_elixir, "~> 2.9"}])
One of the messages I get looks like this:
I get similar messages for example from Req
when a redirect happens...
How can I get rid of all these messages?
Put this in the second line of your script (after the first line where you specify to run it with elixir).
Logger.configure([level: :warning])
This will only show :warning
logs and higher (e.g. :error
).
Maybe you would prefer :info
level.
More info here: https://hexdocs.pm/logger/1.12.3/Logger.html#module-runtime-configuration
If you ever use iex
then it is also possible to configure logger by adding that line to your .iex.exs
file (it usually lives in the project directory or in your home directory or both).