Fix function name logging for db queries