optimize logging in the inner-loop