Integrating $\ln(\tan^2(x) + 1)$ How do I integrate the following function? $$\int_0^\frac{\pi}{4}\ln(\tan^2 x+1) \; dx$$

$$\int_{0}^{\frac{\pi}{4}}\log(\tan^2(x)+1)\,dx = -2\int_{0}^{\frac{\pi}{4}}\log(\cos\theta)\,d\theta $$
then exploiting the Fourier expansion of $\log(\cos\theta)$ it follows that:

$$\int_{0}^{\frac{\pi}{4}}\log(\tan^2(x)+1)\,dx =\color{red}{-K+\frac{\pi}{2}\,\log 2}$$
  where $K$ is Catalan's constant.

