I'm not sure how relevant my code is, but I did something similar using Proxies[0] for a game engine built on javascript (RPG Maker MV) following some useful advice I found online[1].
I presume that the same type of logic could be used to make more powerful loggers.
[0]:https://github.com/ldd/plugin-analyzer [1]:http://exploringjs.com/es6/ch_proxies.html#sec_proxies-expla...