Are the directories you are running the original script on static? if so maybe you could generate an index number for each and include in the log output. Also have you benchmarked the difference between including the directory/direction in the log output? I would not think that it would be that much less efficiant than writing out the log without it.