add hook for api logging