add writelog

writelog added
logfile generation (not finished)