Refactor the code for logging in
Add Logging
Add Logfile option to README