Let $I$ denote the integral given by
$$\begin{align}
I&=\int_0^{2\pi}\log(|2\sin(x)-1|)\,dx\\\\
&=\int_0^{2\pi}\log(|2\cos(x)-1|)\,dx\tag1
\end{align}$$
Enforcing the substitution $z=e^{ix}$ in $(1)$, we find
$$\begin{align}
\require{cancel}
I&=\oint_{|z|=1}\frac{\log(|z+z^{-1}-1|)}{iz}\,dz\\\\
&=\oint_{|z|=1}\frac{\log(|z^2-z+1|)-\cancelto{0}{\log(|z|)}}{iz}\,dz\tag2
\end{align}$$
Inasmuch as $I$ is purely real and $i\arg(z^2-z+1)$ is purely imaginary, then we must have from $(2)$
$$I=\text{Re}\left(\oint_{|z|=1}\frac{\log(z^2-z+1)}{iz}\,dz\right)\tag 3$$
Note that $\frac{\log(z^2-z+1)}{z}$ is analytic in and on the contour $C$ that deforms the unit circle to exclude the branch points with small semi-circular indentations. The contribution to the value to of the integral from integrating around the indentations vanishes as radii of the semicircular indentations goes to $0$. Hence, the integral in $(3)$ is $0$ and we are done.