Is there a way to tap into the send or cast mechanisms to actually execute a callback on every send invoked from a process?
Not with raw sending, I don’t think so. There are things you can do with gen_servers. Could you give some more context on what you wish to do?
You can use the tracing framework for this, that’s how
dbg does it. According to the docs (if I understood them correctly), the callbacks have to be implemented as NIFs, though.
Thank you for the answer!
NIFs would defeat my purpose, but it’s good to know how this works.