The formula is valid for an integral over the positive real line or the negative real line, but it does not work for integrals along complex contours.

I think that the easiest way to do this question is to use a different contour, namely one that goes along the real axis from 1 to |z| and then around a circular arc from |z| to z. The integral along the straight line segment will then give you without any difficulty. For the circular arc, write and parametrise the path by Then