added formatting to writeLog()