add wrapper and func query gen and log