add debug configuration and hook in logging function