Writes to log file