Under what conditions is the argument integral zero? In my studies in complex analysis, I came across the usage of the argument principle to find the number of zeroes and poles of a meromorphic function within a given region. While trying to solve some examples, I stumbled on the following: 
Let $f$ be a meromorphic function defined on a subset $D\subset \mathbb{C}$ and let $x$ and $y$ lie in the upper-half plane and satisfy $f(x)=f(y)$. Moreover, on the straight line connecting $x$ and $y$, the imaginary part of $f$ is constant. I would now like to conclude that the integral along this path
$$
\int_x^y \frac{f'}{f} dz = \int_x^y \frac{d}{dz} \log (f(z))
$$
is well-defined on a single branch of the logarithm, because the fact that the imaginary part of $f$ is constant on this path  and that therefore we must have 
$$
\int_x^y \frac{d}{dz} \log (f(z)) = \log(f(x))-\log(f(y)) = 0.
$$
Am I correct in thinking so? I believe I am not fully grasping why this might work or not. 
 A: You are right (provided that the integral exists, i.e. $f$ has no zero in the segment $[x,y]$). If $\operatorname{Im} f(\zeta) \equiv c$ on the segment $[x,y]$, then the image of the segment under $f$ lies in a domain where a holomorphic branch of the logarithm is defined, so $(\log\circ\, f)$ is a well-defined (holomorphic, of course) function in a neighbourhood of $[x,y]$ and the fundamental theorem of calculus then says that
$$\int_x^y \frac{f'(\zeta)}{f(\zeta)}\,d\zeta = \log f(y) - \log f(x) = 0.$$
If $c\neq 0$, or $c = 0$ and $\operatorname{Re} f(\zeta) > 0$ for all $\zeta\in [x,y]$, then $f([x,y]) \subset \mathbb{C}\setminus (-\infty,0]$, where the principal branch of the logarithm is defined. If $c = 0$ and $\operatorname{Re} f(\zeta) < 0$ for all $\zeta\in [x,y]$, then we can take a branch of the logarithm defined on the left half-plane. If $c = 0$ and the real part of $f(\zeta)$ takes positive as well as negative values, then $f$ has a zero in the segment $[x,y]$, and the integral doesn't exist.
Note that it is important that we have a branch of the logarithm defined in a neighbourhood of $f([x,y])$ to be able to conclude that the integral is zero. If we only know that $f$ has a logarithm $g$ in a neighbourhood of $[x,y]$, i.e. $f(\zeta) = e^{g(\zeta)}$ for all $\zeta$ in some neighbourhood of $[x,y]$, then
$$\int_x^y \frac{f'(\zeta)}{f(\zeta)}\,d\zeta = \int_x^y g'(\zeta)\,d\zeta = g(y) - g(x),$$
and then we can only conclude that the value of the integral is a multiple of $2\pi i$, since $g$ need not attain the same value in $y$ as in $x$.
