       crash_info(min_level, info, [prefix | prefix])]
   end
 
+  defp format_stop({maybe_exception, [_ | _ ] = maybe_stacktrace} = reason) do
+    try do
+      for maybe_entry <- maybe_stacktrace do
+        [<<"\n    ">> | Exception.format_stacktrace_entry(maybe_entry)]
+      end
+    catch
+      :error, _ ->
+        format_stop_banner(reason)
+    else
+      formatted_stacktrace ->
+        [format_stop_banner(maybe_exception, maybe_stacktrace) |
+          formatted_stacktrace]
+    end
+  end
+
+  defp format_stop(reason) do
+    format_stop_banner(reason)
+  end
+
+  defp format_stop_banner(reason) do
+    ["** (stop) " | Exception.format_exit(reason)]
+  end
 
   # OTP process rewrite the :undef error to these reasons when logging
   @gen_undef [:"module could not be loaded", :"function not exported"]
 
-  defp format_otp_exit({undef, [{mod, fun, args, _info} | _ ]  = stacktrace} = reason)
+  defp format_stop_banner(undef, [{mod, fun, args, _info} | _ ]  = stacktrace)
   when undef in @gen_undef and is_atom(mod) and is_atom(fun) do
     cond do
       is_list(args) ->

      is_integer(args) ->
        format_undef(mod, fun, args, undef, stacktrace)
      true ->
        Exception.format_exit(reason)
    end
  end

  defp format_otp_exit(reason) do
    Exception.format_exit(reason)
  end

  defp format_undef(mod, fun, arity, undef, stacktrace) do
    opts = [module: mod, function: fun, arity: arity, reason: undef]
    exception = UndefinedFunctionError.exception(opts)
    Exception.format_exit({exception, stacktrace})
  end
end

          msg = msg <> "Last message: #{inspect last}\n"
                    <> "State: #{inspect state}\n"
        end
        {:ok, [msg | format_stop(reason)]}

      {'** gen_event handler ' ++ _, [name, manager, last, state, reason]} ->
        msg = "GenEvent handler #{inspect name} installed in #{inspect manager} terminating\n"
