def log_exception(exception)
      transaction = @context.new_transaction(
        @app_group_name,
        :exceptions,
        @key)
      begin
        return do_nothing_on_null(:log_exception) if transaction.null?

        base64_message = exception.message
        base64_message = exception.to_s if base64_message.empty?
        base64_message = Utils.base64(base64_message)
        base64_backtrace = Utils.base64(exception.backtrace.join("\n"))

        if controller_action_logged?
          transaction.message("Controller action: #{@controller_action}")
        end
        transaction.message("Request transaction ID: #{@txn_id}")
        transaction.message("Message: #{base64_message}")
        transaction.message("Class: #{exception.class.name}")
        transaction.message("Backtrace: #{base64_backtrace}")
      ensure
        transaction.close
      end
    end
def log_exception(exception)
      transaction = @context.new_transaction(
        @app_group_name,
        :exceptions,
        @key)
      begin
        return do_nothing_on_null(:log_exception) if transaction.null?

        base64_message = exception.message
        base64_message = exception.to_s if base64_message.empty?
        base64_message = Utils.base64(base64_message)
        base64_backtrace = Utils.base64(exception.backtrace.join("\n"))

        if controller_action_logged?
          transaction.message("Controller action: #{@controller_action}")
        end
        transaction.message("Request transaction ID: #{@txn_id}")
        transaction.message("Message: #{base64_message}")
        transaction.message("Class: #{exception.class.name}")
        transaction.message("Backtrace: #{base64_backtrace}")
      ensure
        transaction.close
      end
    end
Logs an exception that occurred during a request.

 If you want to use an exception that occurred outside the
 request/response cycle, e.g. an exception that occurred in a thread,
 use {UnionStationHooks.log_exception} instead.

 If {#log_controller_action_block} or {#log_controller_action}
 was called during the same request, then the information passed to
 those methods will be included in the exception report.

 @param [Exception] exception