Pull request after merging your changes

The only change I have done from yesterday's pull request is to make the log function accept exceptions as well and log it accordingly to the correct file