logging at key code points