G.H. Hardy states the following:
The function of the complex variable $z$
$$ e^{i p z} \log(1 \pm e^{iz})\frac{1}{z^{2} \pm \theta^{2}} = f(z), \ (-1 < p <1, \theta >0),$$ is infinitely-many valued, but can made single-valued by slitting the plane along the real axis and restricting the variable to the upper half.
He then later says,
Again, $\log(1+e^{iz})$ will be shown immediately to have an imaginary part which does not numerically exceed $i \pi$ as $z$ travels along the real axis.
I don't quite understand the second statement.
The function $\log(1+e^{iz})$ can be defined by the complex integral $$\int_{0}^{z}\frac{ie^{iw}}{1+e^{iw}} \, dw + \log 2.$$
The integrand has simple poles at $(2n+1) \pi$ with residue $1$.
Each time we move around one of theses points from left to right, the imaginary part of $\log (1+e^{iz})$ decreases by $\pi$.
Why then does the imaginary part of $\log(1+e^{iz})$ remain bounded as $z$ travels along the real axis?
We consider only $z$ with $\operatorname{Im} z > 0$, and $\lvert e^{iz}\rvert < 1$ then, so $1+e^{iz}$ lies in the right half-plane, and we have a branch of $\log (1+e^{iz})$ on the upper half-plane whose imaginary part is less than $\frac{\pi}{2}$ in absolute value. Thus if
refers to the boundary values of the above branch, as seems reasonable, the boundedness of the imaginary part is immediate. In the integral
$$\int_0^z \frac{ie^{iw}}{1+e^{iw}}\,dw,$$
one would then not take the Cauchy principal value to deal with the poles, but circumnavigate them by using a small semicircle in the upper half-plane, which in the limit, as the radius of the auxiliary semicircles shrinks to $0$, contributes a jump of $-\pi i \operatorname{res}\left(\frac{ie^{iw}}{1+e^{iw}}; (2n+1)\pi\right) = -\pi i$ at the poles, keeping the value within the abovementioned bounds.
For $\log (1-e^{iz})$, the situation is analogous, except that the poles are at $2n\pi$ instead of $(2n+1)\pi$.