Can you execute a callback on every send invoked from a process?

Is there a way to tap into the send or cast mechanisms to actually execute a callback on every send invoked from a process?

2 Likes

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?

3 Likes

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.

2 Likes

Thank you for the answer!
NIFs would defeat my purpose, but it’s good to know how this works.

2 Likes