I'm trying to implement email reporter backend for Logger, which should handle any type of errors/error reports and send them (with sufficient buffering/throttling) to our alert mailing list.
The intention is to handle both errors reported via Elixir.Logger and Erlang's error_logger (OTP reports and SASL reports).
Currently, we are utilizing :errlog_type config option for :sasl application, which allow us to suppress progress report from supervisors by setting it to :error level.
As you know, supervisors aggressively reports their progresses, so without this logs are greatly bloated.
The point is, in :logger application, there is no equivalent to :sasl's :errlog_type when :handle_sasl_reports are set to true.
There is :level option, but (I believe,) it affects globally in Logger, thus setting it to :error suppresses :info level log from Elixir.Logger, too.
I am aware that setting log levels separately for error_logger redirections and Elixir.Logger logs, is a bit too specific.
However, suppressing just supervisor's progress report, might be somewhat common demand, so I opened this thread to request a config option to achieve this in Elixir.Logger.
My rough thought for implementation:
1. Add something like :handle_supervisor_progress option, defaults to true.
config :logger, [
handle_sasl_reports: true,
handle_supervisor_progress: false,
]
2. The value is held in :progress field of the state in Elixir.Logger.ErrorHandler, and handle :progress report only when it is true.
defp log_event({:info_report, _gl, {pid, :progress, data}}, %{sasl: true, progress: true} = state),
do: log_event(:info, :report, pid, {:progress, data}, state)
Would be glad to hear your thoughts. Thanks for reading!
Regards,
Yu