Fourier series of Log sine and Log cos

I saw the two identities
$$
-\log(\sin(x))=\sum_{k=1}^\infty\frac{\cos(2kx)}{k}+\log(2)
$$
and
$$
-\log(\cos(x))=\sum_{k=1}^\infty(-1)^k\frac{\cos(2kx)}{k}+\log(2)
$$
here: twist on classic log of sine and cosine integral. How can one prove these two identities?

Solutions Collecting From Web of "Fourier series of Log sine and Log cos"

Recall that $$\cos(2kx) = \dfrac{e^{i2kx} + e^{-i2kx}}2.$$
Hence,
$$\begin{aligned}\sum_{k=1}^{\infty} \dfrac{\cos(2kx)}k
&= \sum_{k=1}^{\infty} \dfrac{e^{i2kx} + e^{-i2kx}}{2k}
\\&= \dfrac12 \big(-\log (1-e^{i2x} )-\log (1-e^{-i2x} ) \big)
\\&= – \dfrac12 \log \big(2 – 2\cos(2x) \big)
\\&= – \dfrac12 \log\big(4 \sin^2(x)\big)
\\&= – \log 2 – \log\big(\sin(x)\big).\end{aligned}$$
Hence,
$$-\log\big(\sin(x)\big) = \sum_{k=1}^{\infty} \dfrac{\cos(2kx)}k + \log 2.$$
I leave it to you to similarly prove the other one. Both of these equalities should be interpreted $\pmod {2 \pi i}$.