Just for fun, let's see what happens if we use the approach that Lars Ahlfors uses to evaluate $\int_{0}^{\pi} \ln(\sin x) \, \mathrm dx$ in the textbook Complex Analysis: An Introduction to the Theory of Analytic Functions of One Complex Variable.
Let $\ln$ be the principal branch of the logarithm.
For $- \frac{\pi}{2} < x < \frac{\pi}{2}$, we have the identity $$\Re \ln(1+e^{2ix}) = \ln \left(\sqrt{\left(1+\cos(2x)\right)^{2}+ \sin^{2}(x)} \right) = \frac{1}{2} \, \ln \left(4 \cos^{2}(x) \right) = \ln(2 \cos x).$$
Using this identity, we have $$ \begin{align} \int_{0}^{\pi/2} \frac{\ln \left(\cos x \right)}{1+\sin^{2}(x)} \, \mathrm dx &= \frac{1}{2} \int_{-\pi/2}^{\pi/2} \frac{\ln \left(\cos x \right)}
{1+\sin^{2}(x)} \, \mathrm dx \\ &= \frac{1}{2} \, \Re \int_{-\pi/2}^{\pi /2} \frac{\ln \left(1+e^{2ix} \right)}{1+ \sin^{2}(x)} \, \mathrm dx - \frac{1}{2}\int_{- \pi/2}^{\pi/2} \frac{\ln(2)}{1+\sin^{2}(x)} \, \mathrm dx \\ &= \frac{1}{2} \, \Re \int_{-\pi/2}^{\pi /2} \frac{\ln \left(1+e^{2ix} \right)}{1+ \sin^{2}(x)} \, \mathrm dx - \frac{1}{2}\int_{-\infty}^{\infty} \frac{\ln(2)}{1+2t^{2}} \, \mathrm dt \\ &=\frac{1}{2} \, \Re \int_{-\pi/2}^{\pi /2} \frac{\ln \left(1+e^{2ix} \right)}{1+ \sin^{2}(x)} \, \mathrm dx - \frac{\pi \ln(2)}{2 \sqrt{2}}. \end{align}$$
The function $1+e^{2iz}$ is real and nonpositive when $\Re(z) = \pi \, \frac{2n+1}{2}$ ($n \in \mathbb{Z}$) and $\Im(z) \le 0$.
If we omit these half-lines, the principal branch of $\ln(1+e^{2iz})$ is well defined and analytic.
So let's integrate $$f(z) = \frac{\ln \left(1+e^{2iz} \right)}{1+ \sin^{2}(z)} $$ around a tall rectangle contour with vertices at $z= - \pi/2$, $z= \pi/2$, $z= \pi/2 + i R$, $z= -\pi/2 + iR$.
The contour also includes small semicircles about the branch points at $z= \pm \pi/2$, but the integrals along the semicircles vanish as the radii of the semicircles go to zero since $\lim_{z \to \pm \pi/2} z f(z) =0$.
(Near $z= \pm \pi/2$, $\ln(1+e^{2iz}) \sim \ln\left(z \mp \frac{\pi}{2} \right)$.)
The integrals on the vertical sides of the contour are purely imaginary.
And the integral on the top of the contour vanishes as $R \to \infty$ since the magnitude of $f(z)$ decays exponentially to zero.
Since $ \sin(z) =\pm i$ when $z= n \pi \pm i \operatorname{arsinh}(1)$, the only singularity inside the contour is a simple pole at $z= i \operatorname{arsinh}(1) = i\ln (1+ \sqrt{2})$. (See appendix.)
So we have
$$ \begin{align} \Re \int_{-\pi/2}^{\pi/2} \frac{\ln \left(1+e^{2ix} \right)}{1+ \sin^{2}(x)} \, \mathrm dx &= \Re \, 2 \pi i \operatorname{Res} \left[f(z) , z=i \ln(1+ \sqrt{2}) \right] \\ &= \Re \, 2 \pi i \lim_{z \to i \ln(1+\sqrt{2})} \frac{\ln \left(1+e^{2iz} \right)}{\sin(2z)} \\ &= \Re \, 2 \pi i \, \frac{\ln \left(1+ \frac{1}{(1+\sqrt{2})^{2}} \right)}{\frac{1}{2i} \left(\frac{1}{(1+\sqrt{2})^{2}} - (1+\sqrt{2})^{2}\right)} \\&= \pi \, \ln \left(\frac{4+2 \sqrt{2}}{3+2 \sqrt{2}}\right) \frac{3+2 \sqrt{2}}{4+3 \sqrt{2}} \\ &= \frac{\pi}{\sqrt{2}} \, \ln (4-2\sqrt{2}). \end{align}$$
And therefore
$$ \begin{align} \int_{0}^{\pi/2} \frac{\ln \left(\cos x \right)}{1+\sin^{2}(x)} \, \mathrm dx &= \frac{1}{2} \left(\frac{\pi }{\sqrt{2}} \, \ln \left(4-2 \sqrt{2}\right) \right) - \frac{\pi \ln(2)}{2 \sqrt{2}} \\ &= \frac{\pi}{2 \sqrt{2}} \, \ln \left(2- \sqrt{2} \right) \\ &= \frac{\pi}{2 \sqrt{2}} \, \ln \left(\frac{2}{2+\sqrt{2}} \right) \\ &= - \frac{\pi}{2 \sqrt{2}} \, \ln \left(1+ \frac{1}{\sqrt{2}} \right). \end{align}$$
Appendix
$\sin(\pm iz) = \pm i \sinh(z) $
$\sin (n \pi +z) = (-1)^n \sin(z) $
$\sin \left(n \pi \pm i \operatorname{arsinh}(1)\right) = (-1)^n \sin\left( \pm i \operatorname{arsinh}(1) \right) = \pm i (-1)^{n} \sinh\left(\operatorname{arsinh}(1) \right) = \pm i (-1)^{n}$