Evaluating $f(z)=\sqrt{z^2-1}$, given the branch I am on. I'm working on a problem in Gamelin's Complex Analysis (Chapter IV, Section 2, page 109, exercise #4). I'm asked to consider the branch of $f(z)=\sqrt{z^2-1}$ on $D=C\setminus (-\infty,1]$ that is positive on the interval $(1,\infty)$.
Under these conditions, one can supposedly show that $F(z)=\log\left(z+\sqrt{z^2-1}\right)$ is analytic on $D$ and $F'(z)=f(z)$. Thus, if $\gamma(t)=2e^{i\theta}$, where $-\pi/2\le\theta\le\pi/2$, then:
$$\begin{align*}
\int_{\gamma}\frac{dz}{\sqrt{z^2-1}}
&=\log\left(z+\sqrt{z^2-1}\right)\bigg|_{-2i}^{2i}\\
&=\log\left(2i+\sqrt{(2i)^2-1}\right)-\log\left(-2i+\sqrt{(-2i)^2-1}\right)\\
&=\log\left(2i+\sqrt{-5}\right)-\log\left(-2i+\sqrt{-5}\right)\\
&=\log(2i+\sqrt5i)-\log(-2i+\sqrt5i)
\end{align*}$$
The last step here is very suspicious to me at the moment. Continuing:
$$\begin{align*}
\int_{\gamma}\frac{dz}{\sqrt{z^2-1}}
&=\log((2+\sqrt5)i)-\log((-2+\sqrt5)i)\\
&=\left[\log(2+\sqrt5)+i\frac{\pi}{2}\right]-\left[\log(-2+\sqrt5)+i\frac{\pi}{2}\right]\\
&=\log\frac{2+\sqrt5}{-2+\sqrt5}\\
&=\log(9+4\sqrt5)
\end{align*}$$
Mathematica agrees, although I think they have a different definition for the branch cut.
g = Function[z, Log[z + Sqrt[z^2 - 1]]]

g[2 I] - g[-2 I] // ComplexExpand

Output: 
log(2 + Sqrt[5]) - log(Sqrt[5] - 2)

Now, Murray Eisenberg wrote some nice code to compute a contour integral using midpoint sums.

Now, when I take advantage of this routine, here is the result.

Which of course, suggests that the answer is $i\pi$.
Any thoughts?
Additional Comment
I've come up with this image:

For any $z$ not on the cut, we have
$$
\begin{align*}
z-1&=r_1e^{i(\theta_1+2k\pi)}\\
z+1&=r_2e^{i(\theta_2+2m\pi)}\\
\end{align*}
$$
where $r_1$ and $r_2$ are the lengths (magnitudes) of $z-1$ and $z+1$. Hence:
$$
\begin{align*}
\sqrt{z^2-1}
&=\sqrt{z-1}{z+2}\\
&=\sqrt{r_1}\sqrt{r_2}e^{i(\theta_1/2+\theta_2/2+(k+m)\pi)}
\end{align*}
$$
When we evaluate this expression on the real axis and get a positive result for $x>1$, this tells us that $k+m$ must be an even integer. When $k+m$ is odd, the sign of the answer changes. Hence, let's use $k+m=0$ for our branch and write:
$$\sqrt{z^2-1}=\sqrt{r_1}\sqrt{r_2}e^{i(\theta_1/2+\theta_2/2)}$$
Now, when $z=2i$, we can show that
$$
\begin{align*}
\theta_1&=\frac{\pi}{2}-\tan^{-1}2\\
\theta_2&=\tan^{-1}2,
\end{align*}$$
so $\theta_1/2+\theta_2/2=\pi/2$. Hence, at $z=2i$, $\sqrt{z^2-1}$ will equal its magnitude times $e^{i\pi/2}$, that is, times $i$.
On the other hand, note that $\alpha_1/2+\alpha_2/2=-\pi/2$, so at $z=-2i$, $\sqrt{z^2-1}$ will have the same magnitude, but times $e^{-i\pi/2}$, or times $-i$. 
 A: If $\phi(z)$ is the branch of $\sqrt{z^2-1}$ with a branch cut at $(-\infty,1]$ which is positive on $(1,\infty)$, then $\phi(2i)=\sqrt{5}i$ and $\phi(-2i)=-\sqrt{5}i$.  So (writing $\text{Log}$ for the principal value of the logarithm as Gamelin does)
$$\begin{align*}
\text{Log}\left(z+\phi(z)\right)\bigg|_{-2i}^{2i}
&=\text{Log}\left(2i+\phi(2i)\right)-\text{Log}\left(-2i+\phi(-2i)\right)\\
&=\text{Log}((2+\sqrt{5})i)-\text{Log}((2+\sqrt{5})(-i))\\
&=\pi i,
\end{align*}$$
in agreement with the numerical result.
To see that $\phi(2i)=\sqrt{5}i$, let $z$ move along a path from $2$ to $2i$ in the closed first quadrant, for example,  $\theta\mapsto z(\theta):= 2e^{i\theta}$, $0\le \theta\le \pi/2$.  Then $z(\theta)^2-1=4 e^{2i\theta}-1$ will travel from $3$ to $-5$, always remaining in the closed upper half-plane.  Since $\phi(z)$ was defined to be positive on $(1,\infty)$, $\phi(2)=\sqrt{3}>0$, so $\phi(z)$ must also travel along a path in the closed first quadrant.  Therefore $\phi(2i)$ is $\sqrt{5}i$ rather than $-\sqrt{5}i$.  Proving that $\phi(-2i)=-\sqrt{5}i$ can be done in the same way, by moving $z$ on a path from $2$ to $-2i$ in the closed fourth quadrant and observing that, since $z^2-1$ moves along a path in the closed lower half-plane, $\phi(z)$ must travel along a path in the closed fourth quadrant.
