Evaluating $\int_0^{\large\frac{\pi}{4}} \log\left( \cos x\right) \, \mathrm{d}x $
Write $$\log(\cos(x))=\log\left(\frac12 e^{ix}(1+e^{-2ix})\right)\\ =-\log 2 + ix +\sum_{k=1}^\infty\frac{(-1)^{k+1}}{k}e^{-2ikx}.$$ Then integrate term by term to obtain $$\int_0^{\pi/4}\log(\cos(x))dx=-\frac{\pi}{4}\log 2 +i\frac{\pi^2}{32}+\frac{i}{2}\sum_{k=1}^\infty\frac{(-1)^{k+1}}{k^2}\left[e^{-ik\pi/2}-1\right].$$ The odd terms of the series with $e^{-ik\pi/2}$ give rise to the Catalan constant, and the even terms combine with the other infinite series to cancel the $i\pi^2/32$ term.
Let $$ I=\int_0^{\Large\frac\pi4}\ln(\sin x)\ dx\qquad\text{and}\qquad J=\int_0^{\Large\frac\pi4}\ln(\cos x)\ dx $$ then \begin{align} I+J&=\int_0^{\Large\frac\pi4}\ln(\sin x\cos x)\ dx\\ &=\int_0^{\Large\frac\pi4}\ln\left(\frac12\sin 2x\right)\ dx\\ &=\int_0^{\Large\frac\pi4}\ln(\sin 2x)\ dx-\int_0^{\Large\frac\pi4}\ln2\ dx\\ &=\frac12\int_0^{\Large\frac\pi2}\ln(\sin y)\ dy-\frac\pi4\ln2\qquad\color{red}{\Rightarrow}\qquad \text{set}\ y=2x\\ &=-\frac\pi2\ln2 \end{align} and \begin{align} I-J&=\int_0^{\Large\frac\pi4}\ln\left(\frac{\sin x}{\cos x}\right)\ dx\\ &=\int_0^{\Large\frac\pi4}\ln\left(\tan x\right)\ dx\\ &=\int_0^{1}\frac{\ln t}{1+t^2}\ dt\qquad\color{red}{\Rightarrow}\qquad \text{set}\ t=\tan x\\ &=\int_0^{1}\sum_{n=1}^\infty(-1)^n t^{2n}\ln t\ dt\\ &=\sum_{n=1}^\infty(-1)^n\int_0^{1} t^{2n}\ln t\ dt\\ &=-\sum_{n=1}^\infty\frac{(-1)^n}{(2n+1)^2}\\ &=-G, \end{align} where $G$ is Catalan's constant. Therefore $$ I=\int_0^{\Large\frac\pi4}\ln(\sin x)\ dx=-\frac12\left(G+\frac\pi2\ln2\right) $$ and $$ J=\int_0^{\Large\frac\pi4}\ln(\cos x)\ dx=\frac12\left(G-\frac\pi2\ln2\right). $$
References :
$[1]\ \ \displaystyle\int_0^{\Large\frac\pi2}\ln(\sin y)\ dy=\int_0^{\Large\frac\pi2}\ln(\cos y)\ dy=-\frac\pi2\ln2$
$[2]\ \ \displaystyle\int_0^1 x^\alpha \ln^k x\ dx=\frac{(-1)^k k!}{(\alpha+1)^{k+1}}, \qquad\text{for }\ k=0,1,2,\ldots$