The Complex Logarithm and Complex Integration This is a bit of a baby/immature question about complex analysis. I am just not completely comfortable with complex logarithm yet I think and I'm having trouble getting my intuition adjusted.
Suppose we want to integrate $\int_\gamma \frac{1}{z}$ where $\gamma$ is the closed polygonal path $[(1-i),(1+i),(-1+i),(-1-i)]$. 
Clearly the top and bottom parts of the path when cancel upon integration and the left and the right would if it were not for the negative real axis. Now, we have defined the principal logarithm as having imaginary part in $(-\pi,\pi)$ so as to preserve continuity. To integrate the leftmost path I need to choose a different branch of the logarithm which will result in an extra $2 \pi i$ which is what should be expected (i.e. Cuachy's integral formula). However, how does translating, say up, solve my problem because wouldn't it still be crossing the branch for my new branch of the logarithm?
 A: The integral of interest is
$$\int_C \frac{1}{z}\,dz=2\pi i$$
This can be obtained directly using the Residue Theorem.  To see this by direct integration over the prescribed contour, we write the integral as
$$\begin{align}
\int_C \frac{1}{z}\,dz&=\int_{-1}^1 \frac{1}{1+iy}\,idy+\int_{1}^{-1} \frac{1}{x+i}\,dx+\int_{1}^{-1} \frac{1}{-1+iy}\,idy+\int_{-1}^1 \frac{1}{x-i}\,dx\\\\
&=\int_{-1}^1 \frac{2i}{x^2+1}\,dx+\int_{-1}^1\frac{2i}{1+y^2}\,dy\\\\
&=2i(\pi/2)+2i(\pi/2)\\\\
&=2\pi i
\end{align}$$
as was to be shown!
If we wish to use the complex logarithm defined such that $-\pi<\arg(z)\le \pi$, we write
$$\begin{align}
\int_C \frac1z \,dz&=\lim_{\epsilon \to 0^+}\left( \log(-1+i\epsilon)-\log(-1-i\epsilon)\right)\\\\
&=i\pi -(-i\pi)\\\\
&=2\pi i
\end{align}$$
as expected!
A: I've got it figured. So on the left hand side of our square path it CROSSES the negative real axis. We cannot do that as $\log$ is not defined there. However, if we pick a different branch and so we have to pick a different branch because then we won't have $\log(z)=\ln|z|+i0$ where $z$ is on the negative real axis we will have $\log(z)=\ln|z|+2\pi i$. Which will give the value of our integral. 
