Integral $\int_{0}^{\frac{\pi}4} \ln(\sin{x}+\cos{x}+\sqrt{\sin{2x}})dx$

$$I=\int_{0}^{\frac{\pi}4} \ln(\sin{x}+\cos{x}+\sqrt{\sin(2x)})dx =\frac12 \int_0^\frac{\pi}{2} x'\ln(\sin x+\cos x+\sqrt{\sin (2x)})dx$$ $$\overset{IBP}=\frac12 \int_0^\frac{\pi}{2}x\,\frac{\sin x-\cos x}{\sqrt{\sin(2x)}}dx\overset{x=\arctan t}=\frac{1}{2\sqrt 2}\int_0^\infty \frac{\arctan t}{1+t^2}\frac{t-1}{\sqrt t}dt$$


$$I(a)=\int_0^\infty \frac{\arctan(at)}{1+t^2}\frac{t-1}{\sqrt t}dt\Rightarrow I'(a)=\int_0^\infty \frac{(t-1)\sqrt t}{(1+a^2 t^2)(1+t^2)}dt$$ $$\overset{t=x^2}=\frac{2}{1-a^2}\int_0^\infty \frac{1+a^2 x^2}{1+a^2 x^4}dx-\frac{2}{1-a^2}\int_0^\infty \frac{1+x^2}{1+x^4}dx=\frac{\pi}{\sqrt 2}\frac{1-\sqrt a}{\sqrt a (1+a)(1+\sqrt a)}$$


$$\Rightarrow I=\frac{\pi}{4}\int_0^1 \frac{1-\sqrt a}{\sqrt a (1+a)(1+\sqrt a)}da\overset{\sqrt a=x}=\frac{\pi}{2}\int_0^1 \frac{1-x}{(1+x^2)(1+x)}dx=\frac{\pi}{4}\ln 2 $$


Here is a different solution using complex method. We can notice that

\begin{align*} I = &\int_0^{\frac \pi 4} \ln\left(1+\tan x + \sqrt{2\tan x} \right) dx + \int_0^{\frac\pi 4} \ln(\cos x) dx \\ = &I_1 + I_2. \end{align*} Evaluation of $I_1$ : Let $\displaystyle\omega = e^{\frac {\pi i} 4} =\frac{1+i}{\sqrt 2}$ and make substitution $\tan x= y^2 $ to find that \begin{align*} I_1 =& \int_0^1 \log\left((1+\omega y)(1+\bar \omega y)\right)\frac{2y }{1+y^4}dy \\ =& 4 \Re \int_0^1 \frac{y \log\left(\frac{1+\omega y}2 \right)}{1+y^4} dy +\frac {\pi\ln 2}2. \end{align*} Let $\omega y = z$. Then using $\omega^2 = i, \omega^4 = -1$, \begin{align*} \Re \int_0^1 \frac{y \log\left(\frac{1+\omega y}2 \right)}{1+y^4} dy =& \Re \int_0^\omega \frac{ \frac{z}{\omega} \log\left(\frac{1+z}{2}\right)}{1+ (\frac z \omega)^4} \frac{dz}\omega \\ =& \Im \int_0^\omega \frac{z \log\left(\frac{1+z}{2}\right)}{1-z^4} dz \\ =& \frac 1 2 \Im \int_{-\omega}^\omega \frac{z \log\left(\frac{1+z}{2}\right)}{1-z^4} dz. \end{align*} Note that $\displaystyle f(z) = \frac{z \log\left(\frac{1+z}{2}\right)}{1-z^4} $ is analytic in $|z|<1$, and continuous in $|z|\le 1$ except at points $\displaystyle -1, \pm i$. So by choosing a contour $z = e^{i\theta}, -\frac \pi 4\le \theta \le \frac \pi 4$ and using $\log(1+e^{i\theta}) = \log\left(2\cos\left(\frac \theta 2\right)\right) + \frac {i\theta}{2}$, etc, we get \begin{align*} \Im \int_{-\omega}^\omega \frac{z \log\left(\frac{1+z}{2}\right)}{1-z^4} dz =&\Im \int_{-\frac \pi 4}^{\frac \pi 4} \frac{ie^{i2\theta}\left(\log(\cos (\theta/2)) + i\theta/2\right)}{1-e^{i4\theta}} d\theta\\ =&-\Im \int_{-\frac \pi 4}^{\frac \pi 4} \frac{\log(\cos (\theta/2)) + i\theta/2}{2\sin(2\theta)} d\theta\\ =& -\frac 1 4\int_{-\frac \pi 4}^{\frac \pi 4} \frac{\theta}{\sin(2\theta)} d\theta\\ =& -\frac 1 4 \int_{0}^{\frac \pi 4} \frac{\theta}{\sin\theta \cos \theta} d\theta\\ =:& -\frac 1 4 J \end{align*} (In fact $J = G$, the Catalan's number.) This gives $$ I_1 = -\frac 1 2 J +\frac {\pi \ln 2}2. $$

Evaluation of $I_2$ : By integrating by parts, we have \begin{align*} I_2 =& x\ln(\cos x)|^{\frac \pi 4}_0 +\int_0^{\frac \pi 4} \frac {x \sin x}{\cos x} dx \\ =&-\frac{\pi \ln 2}{8} +K. \end{align*} We observe that \begin{align*} K-J = & -\int_0^{\frac \pi 4} \frac{x\cos x}{\sin x} dx\\ =& -x\log(\sin x)|^{\frac \pi 4}_0 + \int_0^{\frac \pi 4} \log(\sin x) dx\\ =& \frac{\pi \ln 2}{8} + \int_{\frac \pi 4}^{\frac\pi 2} \log(\cos x) dx \tag{$\frac \pi 2 - x\mapsto x$}\\ =&-\frac{3\pi \ln 2}{8} -I_2 \end{align*} thus $\displaystyle K = -\frac{3\pi \ln 2}{8} -I_2 +J$ and $$ I_2 = -\frac{\pi \ln 2}{2} -I_2 +J \Longrightarrow I_2 = \frac 1 2 J -\frac{\pi \ln 2}{4}. $$ Therefore, we have $$ I = I_1 + I_2 = \left(-\frac 1 2 J +\frac{\pi\ln 2}2\right)+\left(\frac 1 2 J -\frac{\pi \ln 2}{4}\right) = \frac {\pi \ln 2}4. $$