integral of complex logarithm Consider the integral
$$I=\int_0^{2\pi}\log\left|re^{it}-a\right|\,dt$$
where $a$ is a complex number and $0<r<|a|$. We have
$$I=\operatorname{Re}\left(\int_0^{2\pi}\log\left|re^{it}-a\right|\,dt\right)$$
Let $\gamma=\partial D(0,r)$. Then
$$\begin{align}\int_\gamma\frac{\log(z-a)}{iz}\,dz&=\int_0^{2\pi}\frac{\log\left(re^{it}-a\right)}
{ire^{it}}rie^{it}\,dt\\
&=\int_0^{2\pi}\log\left(re^{it}-a\right)\,dt\end{align}$$
Thus
$$I=\operatorname{Re}\left(\int_{\gamma}\frac{\log(z-a)}{iz}\,dz\right)$$
Now my problem is that $\log(z-a)$ is not holomorphic in $D(0,r)$, so i can't use Cauchy's integral formula to compute $I$. How can I solve this? 
 A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{a \in {\mathbb C}}$.

Lets $\ds{z \equiv r\expo{\ic t}\ \imp\ \dd z = r\expo{\ic t}\ic\,\dd t\ \imp\dd t = {\dd z \over \ic z}}$:

\begin{align}
I&=\left.\int_{0}^{2\pi}\ln\pars{\verts{re^{\ic t} - a}}\,\dd t
\,\right\vert_{\,0\ <\ r\ <\ \verts{a}}\ =\
\Re\int_{0}^{2\pi}\ln\pars{re^{\ic t} - a}\,\dd t
\\[5mm] & =
\Re\oint_{0\ <\ \verts{z}\ =\ r\ <\ \verts{a}}
\ln\pars{z - a}\,{\dd z \over \ic z} =
\Re\pars{2\pi\ic\lim_{z\ \to\ 0}\bracks{z\,{\ln\pars{z - a} \over \ic z}}} =
2\pi\,\Re\pars{\ln\pars{-a}}
\\[5mm] &=
\bbox[10px,border:1px groove navy]{2\pi\ln\pars{\verts{a}}}
\end{align}
A: Because $0<r<|a|,$
$$\ln(a-z)=\ln{a\left(1-\dfrac{z}{a}\right)}=\ln{a}+\ln{\left(1-\dfrac{z}{a}\right)}=\ln{a}+\sum\limits_{k=1}^{\infty}{\frac{(-1)^{k-1}}{k}\cdot\left(\frac{z}{a} \right)^k }.$$
Therefore, Laurent expansion for $\frac{\ln(a-z)}{iz}=-i\frac{\ln(a-z)}{z}$ is
$$-i\frac{\ln{a}}{z}-i\sum\limits_{k=1}^{\infty}{\frac{(-1)^{k-1}}{k}\cdot\frac{z^{k-1}}{a^k } }.$$
Using the residue theorem for integral $\int\limits_{\gamma}\frac{\log(z-a)}{iz}\,dz$ gives
$$\int\limits_{\gamma}\frac{\log(z-a)}{iz}\,dz=2\pi{i}\cdot(-i\ln{a})=2\pi\ln{a}.$$
Taking the real part,
$$\operatorname{Re}\left(\int_{\gamma}\frac{\log(z-a)}{iz}\,dz\right)=\operatorname{Re}(2\pi\ln{a})=2\pi\ln{|a|}.$$ 
