     # and then trying to reach it will lead to crashes. So we send a
     # message to a PID, instead of named process, to avoid crashes on
     # send since this handler will be removed soon by the supervisor.
-    {:ok, %{otp: otp?, sasl: sasl?, threshold: threshold,
-            logger: Process.whereis(Logger), last_length: 0,
-            last_time: :os.timestamp, dropped: 0}}
+    state = %{
+      otp: otp?,
+      sasl: sasl?,
+      threshold: threshold,
+      logger: Process.whereis(Logger),
+      last_length: 0,
+      last_time: :os.timestamp(),
+      dropped: 0
+    }
+
+    {:ok, state}
   end
 
   ## Handle event


  defp log_event({:error, _gl, {pid, format, data}}, %{otp: true} = state),
    do: log_event(:error, :format, pid, {format, data}, state)
  defp log_event({:error_report, _gl, {pid, :std_error, format}}, %{otp: true} = state),
    do: log_event(:error, :report, pid, {:std_error, format}, state)
  defp log_event({:error_report, _gl, {pid, :supervisor_report, data}}, %{sasl: true} = state),
    do: log_event(:error, :report, pid, {:supervisor_report, data}, state)
  defp log_event({:error_report, _gl, {pid, :crash_report, data}}, %{sasl: true} = state),
    do: log_event(:error, :report, pid, {:crash_report, data}, state)

  defp log_event({:warning_msg, _gl, {pid, format, data}}, %{otp: true} = state),
    do: log_event(:warn, :format, pid, {format, data}, state)
  defp log_event({:warning_report, _gl, {pid, :std_warning, format}}, %{otp: true} = state),
    do: log_event(:warn, :report, pid, {:std_warning, format}, state)

  defp log_event({:info_msg, _gl, {pid, format, data}}, %{otp: true} = state),
    do: log_event(:info, :format, pid, {format, data}, state)
  defp log_event({:info_report, _gl, {pid, :std_info, format}}, %{otp: true} = state),
    do: log_event(:info, :report, pid, {:std_info, format}, state)
  defp log_event({:info_report, _gl, {pid, :progress, data}}, %{sasl: true} = state),
    do: log_event(:info, :report, pid, {:progress, data}, state)

  defp log_event(_, _state),
    do: :ok

  defp log_event(level, kind, pid, {type, _} = data, state) do
    %{level: min_level, truncate: truncate,
      utc_log: utc_log?, translators: translators} = Logger.Config.__data__

    with log when log != :lt <- Logger.compare_levels(level, min_level),
         {:ok, message} <- translate(translators, min_level, level, kind, data, truncate) do

  end

  defp drop_messages({m, s, _} = last_time, count) do
    case :os.timestamp() do
      {^m, ^s, _} ->
        receive do
          {:notify, _event} -> drop_messages(last_time, count + 1)
        after
          0 -> count
        end

      _ ->
        count
    end
