Make writeToLog function convert object passed into a string