Avoid unnecessary logging of call

We only need to record all function calls in the diagnosis mode. This
change is included in one of the changes Junyang made on the master
branch. I hope it can be automatically merged by git.