added preliminary code for writing log file, definitely has to be changed
made it build. Also writes a small log file. What is the better way is currently unknown