improved query and error logging

mostly to help troubleshoot
https://github.com/instanttim/monitormate/issues/11