complex main branch of a logarithmic function holomorphic correct

Let $z:= x+iy$ It will now be shown that

$$f(z)= f(x+iy) = \frac{1}{2} \log(x^2 + y^2) + i \arctan\left(\frac{y}{x}\right); (z\in \mathbb{C}, x = \operatorname{Re} z \ne 0),$$

where $arctan$ denotes the main branch of the real $\arctan$ function and $\log$ the real logarithmic function, is (1) : a holomorphic function $(f(z)\in \mathcal{O}(G))$ and that it is (2): a logarithmic function, and also the main branch of the logarihmic function.

For (1): The Cauchy Riemann conditions are checked. $u_{x}=\frac{x}{x^{2}+y^{2}} = v_{y}$ and $u_{y} = \frac{-y^{2}}{x^{2}+y^{2}} = -v_{x}$. Thus f(z) is holomorphic.

(2): A logarithmic function must satisfy $\exp(\log(z)) = z = re^{i\phi}$ And we see that with $\frac{1}{2}\log(x^2+y^2) = \log((x^{2}+y^{2})^{1/2})$ :

$$\exp(\log((x^2 + y^2)^{1/2}) + i\arctan(y/x)) = \sqrt{x^2+y^2}e^{i\arctan(y/x)} = |z|e^{i\phi}$$

and thus $f(z)$ must be a logarithmic function. Since only the main branch of the arctan function is allowed, that means that this is also the main branch of the complex logarithm.

It wasn't shown here that $\arctan(y/x) = \phi$, how do I do that? Is it true that $f(z)$ is a logarithmic function only in the right half plane ?

-

Its not only true that arg($x+iy$) $= \arctan(\frac{y}{x})$ in the right half plane and you can show that by drawing a picture and using the pythagorean theorem. However, the complex logarithm is only holomorphic throughout the entire cut plane = $\{x+iy | x > 0$ or $y \neq 0)$ i.e., the entire complex plane minus the negative $x-$ axis and the origin. It is noted above that only the main branch of $\arctan$ is being used and thus only the main branch of the complex logarithm is being used as well.
It is true that this particular particular $f(z)$ is valid for the right half plane but it is not defined when $x=0$ since $\arctan(\frac{y}{x})$ would not be defined. This is rectified by defining the domain of $f$ such that Re($z$) $\neq 0$.
Thus your function is holomorphic since it deletes points where $x = 0$ and presumes to use only the principle branch of the complex logarithm.