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.
No need of this change