Evaluating $\int_{-\infty}^{\infty}\frac{\ln\left(\frac{1}{2}+x+x^{2}\right)}{1+x^{2}}dx$ (Motivation) This is an integral I made up for fun. WolframAlpha doesn't seem to come up with a closed form for it and I'm surprised there doesn't seem to be a duplicate after using Approach0, but I believe it equals

 $$\pi\ln\left(\frac{5}{2}\right)$$

(Question) Since there seems to be a nice-looking closed form, could there be a cooler or more elegant way of solving this other than my attempt below?
If anyone is willing to look over my attempt and provide constructive criticism, I would greatly appreciate it as someone who seeks to expand his skills in complex analysis.
(Attempt) Let $f(z) = \displaystyle\frac{\log(1/2+z+z^2)}{1+z^2}$. Its poles are $z \in \left\{i,-i\right\}$ and its branch points are $\displaystyle z \in \left\{-\frac{1}{2}+\frac{i}{2}, -\frac{1}{2}-\frac{i}{2}\right\}$. For simplicity's sake, let $\displaystyle z_a = -\frac{1}{2}+\frac{i}{2}$ and $\displaystyle z_b = -\frac{1}{2}-\frac{i}{2}$. With these, we can rewrite $f(z)$ as
$$
\begin{align}
\frac{\log\left(\frac{1}{2}+z+z^{2}\right)}{1+z^{2}} &= \frac{\log\left(\left(z-z_{a}\right)\left(z-z_{b}\right)\right)}{1+z^{2}} \\
&= \frac{1}{1+z^{2}}\left(\log\left(\left|z-z_{a}\right|\cdot\left|z-z_{b}\right|\right)+i\operatorname{arg}\left(\left(z-z_{a}\right)\left(z-z_{b}\right)\right)\right) \\
&= \frac{1}{1+z^{2}}\left(\log\left|z-z_{a}\right|+\log\left|z-z_{b}\right|+i\operatorname{arg}\left(z-z_{a}\right)+i\operatorname{arg}\left(z-z_{b}\right)\right).
\end{align}
$$
But for the equalities to hold, define $\displaystyle \operatorname{arg}(z-z_a) \in \left(\frac{3\pi}{4},\frac{11\pi}{4}\right)$ and $\displaystyle \operatorname{arg}(z-z_b) \in \left(-\frac{11\pi}{4},-\frac{3\pi}{4}\right)$. Here is a visual of the keyhole contour.

By Cauchy's Residue Theorem, we get
$$2\pi i \operatorname{Res}(f(z),z=i) = \left(\int_{-R}^{R}+\int_{\Gamma}+\int_{\lambda_1}+\int_{\gamma}+\int_{\lambda_2}\right)f(z)dz.$$
(I forgot to put this in the picture, but $\gamma$ has a small radius $r$ and the gaps between the branch cut and the $\lambda$s have a small length of $\epsilon$).
As $R \to \infty$ and $r \to 0$, it can be proved that $\displaystyle \int_{\Gamma}f(z)dz$ and $\displaystyle \int_{\gamma}f(z)dz$ go to $0$.
For the contour integrals over $\lambda_1$ and $\lambda_2$, let them approach the branch cut $\Lambda$. So
$$
\begin{align}
& \lim_{R \to \infty}\lim_{\lambda_1, \lambda_2 \to \Lambda}\left(\int_{\lambda_1} + \int_{\lambda_2}\right)f(z)dz \\
=& \lim_{R \to \infty}\lim_{\epsilon \to 0}\int_{Rz_{a}}^{z_{a}}f\left(z+i\epsilon\right)d\left(z+i\epsilon\right) + \lim_{R \to \infty}\lim_{\epsilon \to 0}\int_{z_{a}}^{Rz_{a}}f\left(z-i\epsilon\right)d\left(z-i\epsilon\right) \\
=& \lim_{R \to \infty}\lim_{\epsilon \to 0}\int_{Rz_{a}}^{z_{a}}\frac{d\left(z+i\epsilon\right)}{1+\left(z+i\epsilon\right)^{2}}\left(\log\left|z+i\epsilon-z_{a}\right|+\log\left|z+i\epsilon-z_{b}\right|+i\operatorname{arg}\left(z+i\epsilon-z_{a}\right)+i\operatorname{arg}\left(z+i\epsilon-z_{b}\right)\right) \\
&+ \lim_{R \to \infty}\lim_{\epsilon \to 0}\int_{Rz_{a}}^{z_{a}}\frac{d\left(z-i\epsilon\right)}{1+\left(z-i\epsilon\right)^{2}}\left(\log\left|z-i\epsilon-z_{a}\right|+\log\left|z-i\epsilon-z_{b}\right|+i\operatorname{arg}\left(z-i\epsilon-z_{a}\right)+i\operatorname{arg}\left(z-i\epsilon-z_{b}\right)\right) \\
=& -\int_{z_a}^{i\infty}\frac{dz}{1+z^2}\left(\log\left|z-z_{a}\right|+\log\left|z-z_{b}\right|+\frac{11\pi i}{4}+i\operatorname{arg}\left(z-z_{b}\right)\right) \\
&+ \int_{z_a}^{i\infty}\frac{dz}{1+z^2}\left(\log\left|z-z_{a}\right|+\log\left|z-z_{b}\right|+\frac{3\pi i}{4}+i\operatorname{arg}\left(z-z_{b}\right)\right) \\
=& -2\pi i \int_{z_a}^{i\infty}\frac{dz}{1+z^2} \\
&= i\pi\left(\frac{\pi}{2}+\arctan\left(\frac{1}{2}\right)\right)-\frac{\pi}{2}\ln\left(5\right). \\
\end{align}
$$
Next, we will evaluate the residue at the simple pole $z=i$ like this:
$$2\pi i \operatorname{Res}(f(z),z=i) = 2\pi i \lim_{z \to i}\frac{\left(z-i\right)\log\left(\frac{1}{2}+z+z^{2}\right)}{\left(z-i\right)\left(z+i\right)} = \pi\ln\left(\frac{\sqrt{5}}{2}\right)+i\pi\left(\frac{\pi}{2}+\arctan\left(\frac{1}{2}\right)\right).$$
Gathering everything together and taking the appropriate limits, we get
$$\pi\ln\left(\frac{\sqrt{5}}{2}\right)+i\pi\left(\frac{\pi}{2}+\arctan\left(\frac{1}{2}\right)\right) = \int_{-\infty}^{\infty}f\left(x\right)dx + 0 + i\pi\left(\frac{\pi}{2}+\arctan\left(\frac{1}{2}\right)\right)-\frac{\pi}{2}\ln\left(5\right) + 0.$$
In conclusion,
$$\int_{-\infty}^{\infty}\frac{\ln\left(\frac{1}{2}+x+x^{2}\right)}{1+x^{2}}dx = \pi\ln\left(\frac{5}{2}\right).$$
 A: A simpler method using contour integration:
$$\begin{align} \int_{-\infty}^{\infty} \frac{\ln\left(\frac{1}{2}+x+x^{2}\right)}{1+x^{2}} \, \mathrm dx &= 2 \,  \Re \int_{-\infty}^{\infty} \frac{\ln \left(x+ \frac{1}{2} + \frac{i}{2} \right)}{1+x^{2}} \, \mathrm dx\\ &= 2 \, \Re \left( 2 \pi i \operatorname{Res} \left[\frac{\ln \left(z+ \frac{1}{2}+\frac{i}{2}\right)}{1+z^{2}}, i \right] \right) \\ &= 2 \, \Re \left(\pi  \ln\left( \frac{3i}{2}+ \frac{1}{2} \right)\right) \\ &= 2 \pi \ln \left(\sqrt{\frac{10}{4}} \right) \\ &= \pi \ln \left(\frac{5}{2} \right) \end{align}$$
A: Utilize $\int_{0}^{\infty}\frac{\ln\left(a^2+x^{2}\right)}{1+x^{2}}dx = \pi\ln(1+a)$ to integrate
\begin{align}\int_{-\infty}^{\infty}\frac{\ln\left(\frac{1}{2}+x+x^{2}\right)}{1+x^{2}}dx
=&\int_{0}^{\infty}\frac{\ln\left(\frac{1}{4}+x^{4}\right)}{1+x^{2}}dx= 2\Re \int_{0}^{\infty}\frac{\ln\left(\frac{i}{2}+x^{2}\right)}{1+x^{2}}dx\\
=& \ 2\Re \left(\pi \ln \frac{3+i}2\right)=\pi\ln\frac52
\end{align}
A: There is even an antiderivative.
Write
$$\frac{\log \left(x^2+x+\frac{1}{2}\right)}{x^2+1}=\frac{\log \left((x-a)(x-b)\right)}{(x+i)(x-i)}$$ wtih
$$a=-\frac{1+i}{2} \qquad \text{and} \qquad b=-\frac{1-i}{2}$$
$$\frac 1{(x+i)(x-i)}=\frac i 2\left(\frac{1}{x+i}-\frac{1}{x-i}\right)$$ and face four integrals looking like
$$\int \frac{\log(x-c)}{x-d}=\text{Li}_2\left(-\frac{x-c}{c-d}\right)+\log (x-c) \log \left(\frac{x-d}{c-d}\right)$$
Edit
As @Ninad Munshi suggested in comments, write
$$I(a)=\int_{-\infty}^{+\infty}\frac{\log \left(\left(x+\frac{1}{2}\right)^2+a\right)}{x^2+1}$$
$$I'(a)=\int_{-\infty}^{+\infty}\frac{dx}{\left(x^2+1\right)
   \left(\left(x+\frac{1}{2}\right)^2+a\right)}$$
$$I'(a)=\frac{4 \pi  \left(1+\frac{1}{\sqrt{a}}\right)}{4 a+8 \sqrt{a}+5}$$
$$\int_0^b I(a)\,da=\pi  \log \left(\frac{4 b+8 \sqrt{b}+5}{5}\right) $$ and
$$I(0)= \pi  \log \left(\frac{5}{4}\right)$$
So, as a total
$$\int_{-\infty}^{+\infty}\frac{\log \left(\left(x+\frac{1}{2}\right)^2+b\right)}{x^2+1}=\pi  \log \left(b+2 \sqrt{b}+\frac{5}{4}\right)$$
