update write_log function