Compute an indefinite integral of logarithms. Is there a simple way of proving the following identity:
\begin{eqnarray}
\int \log(x) \log(x^2 + (x + W)^2) dx = \\
 2 x + \left(1 - \log(x)\right) 
\left(\log(e^{-\pi/2} W) W + 2 x + W \arctan(\frac{x+W}{x}) 
- (\frac{W}{2} + x)\log(x^2 + (x+ W)^2) \right) + \frac{W}{2} Re\left[(1-\imath) Li_2\left(-\frac{(1+\imath) x}{W}\right)\right)
\end{eqnarray}
I have obtained it by typing the integral into Mathematica and tediously simplified by hand the multitude of different terms that Mathematica produced. Then I differentiated the result and checked that it was correct.I was wondering whether there was some other , faster and more legant way to obtain the result. 
 A: Note that since the second order polynomial inside the second log on the left hand side factorizes over complex numbers the only thing we need to do is to compute the following indefinite integral:
\begin{equation}
I_a(x) :=\int \log(x) \log(x+a) dx
\end{equation}
This is done by integrating by parts and by using the definition of the dilogarithm. We have:
\begin{eqnarray}
I_a(x) &=& (x \log(x)-x) \log(x+a) - \int (x \log(x)-x) \frac{1}{x+a} dx  \\
&=&  (x \log(x)-x) \log(x+a) - \int  \log(x) \left(1-\frac{a}{x+a}\right) dx + \left(x - a \log(x+a)\right) \\
&=& (x \log(x)-x) \log(x+a) - \left(x \log(x)-x\right)+a\int  \log(x) \left(\frac{1}{x+a}\right) dx + \left(x - a \log(x+a)\right)
\end{eqnarray}
Now, the remaining integral is done by reducing it to the integral representation of the dilogarithm. We have:
\begin{eqnarray}
\int  \log(x) \left(\frac{1}{x+a}\right) dx = \int \log(y-a) \frac{1}{y} d y = (\log(a)- \imath \pi) \log(y) - Li_2(\frac{y}{a})
\end{eqnarray}
where $y=x+a$. Bringing everything together we have:
\begin{equation}
I_a(x) = \left(x \log(x) - x\right) \left(\log(x+a)-1\right)+\left(x - a \log(x+a)\right)+a \left(\log(a)-\imath \pi\right) \log(x+a) - a Li_2(\frac{x+a}{a})
\end{equation}
