implement query logger