Add query logging.

Three new options added
- log_queries, if true log queries, defaults to false
- log_queries_filename, the file where queries are logged, defaults to `queries.log`
- log_queries_threshold, only log queries that run slower than threshold (in milliseconds)
  defaults to 0, i.e. log all queries.
I'm not super happy with having to add this just to be able to test something that doesn't really belong in the HA module in the first place. The query logger was put in the HA module simply because the query logger is so small, and the HA module is where every other "extra enterprise feature" have gone.

Should now be the time that we create separate modules for the various enterprise features of the product?

The biggest problem with adding such a module IMO is making sure it makes it into the packaging.