    # File lib/amalgalite/database.rb, line 391
        def trace_tap=( tap_obj )

          # unregister any previous trace tap
          #
          unless @trace_tap.nil?
            @trace_tap.trace( 'unregistered as trace tap' )
            @trace_tap = nil
          end
          return @trace_tap if tap_obj.nil?

          # wrap the tap if we need to
          #
          if tap_obj.respond_to?( 'trace' ) then
            @trace_tap = tap_obj
          elsif tap_obj.respond_to?( 'write' ) then
            @trace_tap = Amalgalite::TraceTap.new( tap_obj, 'write' )
          else
            raise Amalgalite::Error, "#{tap_obj.class.name} cannot be used to tap.  It has no 'write' or 'trace' method.  Look at wrapping it in a Tap instances."
          end

          # and do the low level registration
          #
          @api.register_trace_tap( @trace_tap )

          @trace_tap.trace( 'registered as trace tap' )
        end