I'm supposed to proof that
$$i\int_\gamma \operatorname{Arg}(z)dz=\frac{\pi}{2}+\ln{2}$$
when the path is rectangular having its angles at $\pm 1$ and $\pm 1+i$ , going counterclockwise.
My effort
I split the path into 4 parametric curves
$0 \leq t \leq 1$
\begin{cases} z_1(t)= 1+it & \quad dz_1=(i)dt\\ z_2(t)= 1-2t+i & \quad dz_2=(-2)dt\\ z_3(t)= -1+i(1-t) & \quad dz_3=(-i)dt\\ z_4(t)= -1+2t & \quad dz_4=(2)dt \end{cases}
Giving $$\int_0^1i \operatorname{Arg}(1+it)(i)dt+\int_0^1i\operatorname{Arg}(1-2t+i )(-2)dt \\ +\int_0^1i\operatorname{Arg}(-1+i(1-t))(-i)dt+\int_0^1i\operatorname{Arg}(-1+2t)(2)dt$$
And this is where the problem occurs. I know that $\operatorname{Arg}(z)$ can be expressed with $\tan^{−1}()$, but that makes the integral very complicated.
Any help & tips will be appreciated.
It's not actually all that bad. Take a point on the line $x = 1$. Then writing a point $(1, t)$ on that line in polar form, we have that it's $\sqrt{1 + t^2} e^{i\theta}$ where $\tan \theta = t$.
So we can say that
\begin{align*} \int_0^1 \operatorname{Arg}(1 + it) \, dt &= \int_0^1 \arctan(t) \, dt \\ \end{align*}
Now integrate by parts, using $u = \arctan t$ and $dv = dt$. You should find that
$$\int_0^1 \arctan t \, dt = t \arctan t \big|_{0}^1 - \int_0^1 \frac{t}{1 + t^2} \, dt = \frac{\pi}{4} - \frac 1 2 \ln(1 + t^2) \big|_0^1 = \frac{\pi}{4} - \frac 1 2 \ln 2.$$
The other integrals are pretty similar, with the caveat that you need to be careful around your branch cut.