Question on integrating $\frac{1}{2\pi}\int_0^{2\pi} \log(e^{ix})dx$? I evaluated the integral
$$
\frac{1}{2\pi}\int_0^{2\pi} \log(e^{ix})dx,
$$
in Wolfram Alpha and the result was $0$. But if I do it analytically I get
$$
\frac{1}{2\pi}\int_0^{2\pi} \log(e^{ix})dx = \frac{1}{2\pi}\int_0^{2\pi} ix \ dx = i 2 \pi.
$$
So why does Wolfram Alpha say that the integral is $0$?
 A: Wolfram Alpha computes Log function which returns the principal value of $\log(r e^{i\theta}) = \log(r) + \phi$, where $\phi \in (-\pi,\pi]$ is the principal argument (for example, if $\theta = 3\pi/2$ then $\phi=-\pi/2$). Basically, you are evaluating $$\frac{i}{2\pi} \int_{-\pi}^{\pi} x dx.$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
{1 \over 2\pi}\int_{0}^{2\pi}\ln\pars{\expo{\ic x}}\,\dd x & =
{1 \over 2\pi}\oint_{\verts{z} = 1}\ln\pars{z}\,{\dd z \over \ic z}\qquad
\pars{~\substack{\ds{\ln\ \mbox{is its}\ Principal\ Branch.}\\[3mm]
\mbox{Integration is performed along a}\\[1mm]
\ds{key-hole\ contour}\ \mbox{which 'takes care'}
\\[1mm]
\mbox{of the}\ \ds{\ln}\ \mbox{branch-cut.}}~}
\\[5mm] \stackrel{\mrm{as}\ \epsilon\ \to\ 0^{\large +}}{\sim}\,\,\,&
-\,{1 \over 2\pi\ic}\int_{-1}^{-\epsilon}{\ln\pars{-x} + \ic\pi\over x}\,\dd x -
{1 \over 2\pi\ic}\int_{\pi}^{-\pi}{\ln\pars{\epsilon} + \ic\theta \over \epsilon\expo{\ic\theta}}\,\epsilon\expo{\ic\theta}\ic\,\dd\theta
\\ &
-\,{1 \over 2\pi\ic}\int_{-\epsilon}^{-1}{\ln\pars{-x} - \ic\pi\over x}\,\dd x
\\[5mm] & =
{1 \over 2\pi\ic}\int_{\epsilon}^{1}{\ln\pars{x} + \ic\pi\over x}\,\dd x + \ln\pars{\epsilon} -
{1 \over 2\pi\ic}\int_{\epsilon}^{1}{\ln\pars{x} - \ic\pi\over x}\,\dd x
\\[5mm] & =
-\,{1 \over 2}\,\ln\pars{\epsilon} + \ln\pars{\epsilon} -
{1 \over 2}\,\ln\pars{\epsilon}
\,\,\,\stackrel{\mrm{as}\ \epsilon\ \to\ 0^{\large +}}{\large\to}\,\,\,
\bbx{0}
\end{align}
