Convert backtrace to string when logging