Add getter for loggingQueries

We currently have `DB::disableQueryLog();` and `DB::enableQueryLog();` but no `DB::getQueryLogState();` (`getQueryLog()` is already taken up for something unrelated).

Having this getter would allow developers to disable query log for DB-intensive operations then return logging to its previous state instead of having to guess what it was beforehand and setting to that.