Blender BGE: set up a counter (python)
Add integer property to the object running this script and keep incrementing this property :

cont = bge.logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()

def spawnObjects():

    scene.addObject(randomObject1, "empty1", 90)
    scene.addObject(randomObject2, "empty2", 90)

spawnObjects()
own['counter'] += 1 # this is the property that keeps count
print ("Spawned Objects %d are:"%own['counter'], randomObject1, randomObject2)


you can add a loop to spawn multiple objects at the same time,
you don't use a local variable ( defined inside the script )  because it get reset every execution of the script so you'll lose the count ,unless that is what you want.