Add logging to term operations