ENH: refined query logging