Deducing $\int_0^{\pi}\log \sin x dx =-\pi\log 2$ from $\int_0^{\pi}\log (-2ie^{ix}\sin x) dx = 0$

branch-cutscomplex integrationcomplex numberscomplex-analysislogarithms

On Ahlfors Complex Analysis, chpter 5.3, the author explains how to evaluate $\int_0^{\pi}\log \sin x dx =-\pi\log 2$. He does so by using Cauchy's formula to deduce that
$$\int_0^{\pi}\log (-2ie^{ix}\sin x) dx = 0.$$
I get why the above is true, thanks to Ahlfors' explanation in the texbook. However, he claims the following:

If we choose $\log {e^{ix}}= ix$ the imaginary part lies between $0$ and $\pi $. Therefore, in order to obtain the principal branch with an imaginary part between $-\pi $ and $\pi $, we must choose $\log (-i) = -\pi i / 2$. The equation can now be written in the form $$ \pi \log 2 – (\frac {\pi^2}{2})i + \int_0^\pi\log\sin x dx + (\frac {\pi^2}{2})i = 0.$$

What does the author mean by this? I know that $\log (z_1z_2) = \log z_1 + \log z_2 + 2\pi i n $ for some integer $n$ depending on $z_1$ and $z_2$, and I imagine that the author is trying to make the $m$ zero where $m $ is the integer satisfying $\log (-2ie^{ix}\sin x) = \log 2 + \log (-i) + \log {e^{ix}} + \log\sin x + 2\pi i m $ but I do not get how exactly he is coming up with a branch of a logarithm.

Best Answer

Since $2\sin x>0$ between the integration limits, we can focus just on $\ln(-ie^{ix})$. As Ahlfors notes, $\log(-i)=-\pi i/2$ is the branch choice for which $\ln(-ie^{ix})$ has range $\subseteq(-\pi,\,\pi]$ (in fact, it's $[-\pi/2,\,\pi/2]$). Any other branch shifts the range by some integer multiple of $2\pi$, so it's no longer constrained as desired.