See (annalist) for something that has been implemented in this area.
Let EMC be the entry monitor creator.
EMC(0;SB,M,N ==> c;ME) "Create Entry Monitor"
ME is a monitored entry key. Whenever ME is called, the call is recorded by a call of the form MB(order code,(byte string passed to ME); ==> ;). Then the call is passed on to key E.
Keys are not recorded. Returns from E are not recorded.
MB can be a multiplexor branch key.
C is loose end.