You are in the right path with Exception.format_banner/3, but this function does not print the stacktrace. Instead, use Exception.format/3, and you will be good to go.
Now about the kind parameter, is basically one of this 3 options: :error, :throw or :exit. For exceptions catched with try do ... rescue, use the :error kind.
I ran into a related problem. I wanted to log an exception with the correct metadata for it to be treated as an exception by error trackers like Sentry.