The mysqli_dump_debug_info() function dumps debugging info into the log.
mysqli_dump_debug_info(link);