Capturing logger and sending it to my own API

I am using the iFrame API and looking to capture the logger events and post to my own API to store them. I have looked around but am quite confused how to hook onto the logger events to get the information out into JSON or similar… It would be really appriciated if someone could point me in the right direction?