If I have an integral $\int_C \frac{1}{z} dz$ where $C$ is the left half of the circle from $i$ to $-i$, then I can choose the branch cut to be the positive axis, and have the antiderivative to be log(z). Then using the antiderivative, I can evaluate the integral:
$\int_C \frac{1}{z} dz = log(-i) - log(i)$
However, if I let $0 \leq arg(z) < 2\pi$, my integral will evaluate to $\frac{3\pi}{2} - \frac{\pi}{2} = \pi$. If I choose $-\pi \leq arg(z) < \pi$, then my integral will evaluate to $\frac{-\pi}{2} - \frac{\pi}{2} = -\pi$. I feel like I should get the same value. What am I doing wrong here.
Solving the integral by parametrization yields:
$$\int_{C} \frac{dz}{z} = \int_{\pi/2}^{3\pi/2} \frac{1}{e^{i \theta}} ie^{i \theta} \, d \theta=i \pi$$
You may arrive at the same result by choosing the branch of the logarithm given by
$$\log_0 (x) = \text{Log} |z| + i \arg_0(z),$$
where $\arg_0(z) \in [0, 2\pi)$, and using it as a primitive for $\frac{1}{z}$. As mentioned, we choose this branch since the contour passes through the negative real axis. This branch of the logarithm however, has its branch cut at the positive real axis. We get
$$\int_{C} \frac{dz}{z} = \log_0 (-i) - \log_0(i) =i (\frac{3\pi}{2}-\frac{\pi}{2})=i \pi$$
Using the principal branch of the logarithm instead will give a wrong result because it is not a primitive of the function we are integrating in an open set containing the contour over which we integrate.