While reading a chapter on approximation of prime counting function $\pi(x)$ from the book Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work by G. H. Hardy I came across an identity concerning integral of $a^{x + 1}/\Gamma(x + 1)$ namely $$\int_{0}^{\infty}\frac{a^{x + 1}}{\Gamma(x + 1)}\,dx = e^{a} - \int_{0}^{\infty}\frac{e^{-ax}}{x\{\pi^{2} + (\log x)^{2}\}}\,dx\tag{1}$$ I don't see any easy route to proving the above (probably because I am not so much used to evaluation of integrals via residue theorem).
Any hints or a proof of $(1)$ (preferably via elementary techniques) will be greatly appreciated.