change your code like this
ini_set('log_errors',1);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
mysqli_connect(credentials);
...
$result = mysqli_query($db, "INSERT INTO device(`Identifier`, `IsAllowedToPost`)
VALUES('ABC123', 0)");
and watch your mysql errors in php error log.
Code you wrote is suffering from some wrong premises.
- You apparently need to log ALL errors occurred in your code, not only mysql-related ones. Such a separation makes no sense. So, you need a common log.
- You don't need to write distinct code for the every query. Mysqli is smart enough to raise an error automatically.
- setting error log file with relative path will result in multiple logs, according to directory structure.