hook into "library" function call and log events to r index every time the library function is called