Added function which enabled logging
default output file is defined in my.ini (or my.conf)
Added variables that holds the last error
Sometimes I cannot rely on mysqli->error so this helps