Edit: I have proved a little more. Namely, this integral is $0$ for $| r|\leq 1$, and $4\pi\log|r|$ for $|r|\geq 1$.
1) If $r=0$, this is $0$.
2) Now assume $0< r\leq 1$. We have
$$
1-2r\cos x+r^2=(1-re^{ix})(1-re^{-ix})=|1-re^{ix}|^2.
$$
Hence the integral can be written
$$
2\int_0^{2\pi}\log |1-re^{ix}|dx=4\pi\cdot \frac{1}{2\pi} \int_0^{2\pi}\log |1-re^{ix}|dx=
\frac{2}{i}\int_{\gamma_r}\frac{\log|1-z|}{z}dz.
$$
where $\gamma_r(x)=re^{ix}$ over $[0,2\pi]$, i.e. $\gamma_r$ is the circle of radius $r$ centered at $0$.
Shortcut: as pointed out by robjohn, $\log|1-z|=\mbox{Re}\;\log(1-z)$, so we can conclude by Cauchy's integral formula. I'll leave my harmonic argument below.
Recall that if $f$ is holomorphic, then $\log|f|$ is harmonic on its domain. So $$g:z\longmapsto \log|1-z|$$ is harmonic on the open unit disk $D=\{z\in\mathbb{C}\;;\;|z|<1\}$.
If $0<r<1$, then the circle $\gamma_r$ is contained in $D$ and contains $0$, so
$$
0=g(0)=\frac{1}{2\pi} \int_0^{2\pi}g(re^{ix})dx=\frac{1}{2\pi} \int_0^{2\pi}\log |1-re^{ix}|dx
$$
by the mean value property of harmonic functions.
3) For $r=1$ now. Fix $x$ and study the variations of $r\longmapsto \log(1-2r\cos x+r^2)$ on $[0,1]$. If $\cos x\leq 0$, this is increasing and nonnegative, so $|\log(1-2r\cos x+r^2)|\leq \log(1-2\cos x+1)$. And if $\cos x\geq 0$, it is nonpositive with a minimum at $r=\cos x$, so $|\log(1-2r\cos x+r^2)|\leq| \log(1-2\cos^2 x+\cos^2 x)|=| \log(\sin^2 x)|$. In any case, we see that the integrand is uniformly bounded by an integrable function. It follows that
$$
\int_0^{2\pi}\log(1-2\cos x+1)dx=\lim_{r\rightarrow 1^-} \int_0^{2\pi}\log(1-2r\cos x+r^2)dx=0
$$
by Lebesgue dominated convergence.
So these integrals are $0$ for every $0\leq r\leq 1$.
4) By change of variable and periodicity, we get $0$ for $-1\leq r\leq 1$.
5) Finally, for $|r|>1$, we get
$$
\int_0^{2\pi}\log(1-2r\cos x+r^2)dx=\int_0^{2\pi}\log\left(r^2\left(\frac{1}{r^2}-2\frac{1}{r}\cos x+1\right)\right)dx
$$
$$
=\int_0^{2\pi}\log r^2dx+ \int_0^{2\pi}\log\left(\frac{1}{r^2}-2\frac{1}{r}\cos x+1\right)dx=4\pi \log |r|+0.
$$