MOTIVATION:
In this question, the OP asked to prove the Cosine Integral identity
$$-\int_x^\infty \frac{\cos(t)}{t}\,dt=\gamma+\log(x)+\int_0^x \frac{\cos(t)-1}{t}\,dt$$
where $\gamma $ is the Euler-Mascheroni constant. However, the two posted answers are incomplete and seem unsatisfactory.
Proof Using Complex Anaysis
One can show for $x>0$ that $-\int_x^\infty \frac{\cos(t)}{t}\,dt=\gamma+\log(x)+\int_0^x \frac{\cos(t)-1}{t}\,dt$ using contour integration. To wit, Cauchy's Integral Theorem guarantees that
$$\begin{align} 0&=\oint_C \frac{e^{iz}}{z}\,dz\\\\ &=\int_\epsilon^R \frac{e^{ix}}{x}\,dx +\int_0^{\pi/2}\frac{e^{iRe^{i\phi}}}{Re^{i\phi}}\,iRe^{i\phi}\,d\phi+\int_R^\epsilon \frac{e^{-x}}{ix}\,i\,dx+\int_{\pi/2}^0 \frac{e^{i\epsilon e^{i\phi}}}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\\\\ &=\int_\epsilon^R \frac{e^{ix}}{x}\,dx -\int_\epsilon^R \frac{e^{-x}}{x}\,dx-i\frac\pi2+O(\epsilon)+O\left(\frac1R\right)\tag1 \end{align}$$
whence after taking the real part of both sides of $(1$ and integrating by parts the integral $\int_\epsilon^R \frac{e^{-x}}{x}\,dx$ with $u=e^{-x}$ and $v=\log(x)$, we find
$$\begin{align}-\int_x^R \frac{\cos(x')}{x'}\,dx'&=\log(x)-\int_\epsilon^R e^{-x}\log(x)\,dx+\int_\epsilon^x\frac{\cos(x')-1}{x'}\,dx'\\\\ &-\log(\epsilon) -e^{-R}\log(R)+e^{-\epsilon}\log(\epsilon)+O\left(\frac1R\right)+O(\epsilon)\tag2 \end{align}$$
Letting $R\to\infty$ and $\epsilon\to 0$ in $(2)$ yields the sought relationship.
Proof Using Real Analysis
Alternatively, we can use either the Laplace Transform or "Feynman's Trick" to show that
$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=\int_0^\infty \left(\frac{x}{x^2+1}-\frac1{x+1}\right)=0\tag3$$
Starting with $(3)$, is tantamount to starting with the real part of $(1)$ and we are done.
QUESTION: So, what are other ways to prove the coveted relationship using real analysis tools only?