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.
error_handler.ex#L67 
<https://github.com/elixir-lang/elixir/blob/master/lib/logger/lib/logger/error_handler.ex#L67>
  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

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/2562e8fa-2d07-481b-8f6e-54214860efdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to