<s>[INST] Frullani like Trig integral $$\int_{0}^{\infty}\frac{\left|\cos\left ( x-\frac{\pi}{4} \right ) \right|- \left|\cos\left ( x+\frac{\pi}{4} \right ) \right| }{x}dx=\sqrt{2}\ln(1+\sqrt{2})$$ The above integral seems to look like a frullani type integral and has a closed form in terms of natural log. I tried to indefinitely integrate it. But the closed form are in terms $\text{Si}(x)$ and $\text{Ci}(x)$. I would highly  appreciate if there's any method or unique  substitution  to evaluate  this Integral.
 [/INST] Let $$I = \int_{0}^{\infty} \frac{\left|\cos\left(x-\frac{\pi}{4}\right) \right|-\left|\cos\left(x+\frac{\pi}{4}\right) \right|}{x} \, \mathrm dx .$$
Then
$ \require{cancel} \begin{align}I &= \int_{0}^{\infty}\frac{\left|\cos\left(x-\frac{\pi}{4}\right) \right|-\left|\sin\left(x-\frac{\pi}{4} \right) \right|}{x} \, \mathrm dx  \\ &\overset{(1)}{=} \int_{0}^{\infty} \mathcal{L} \left\{\left|\cos\left(x-\frac{\pi}{4}\right) \right|-\left|\sin\left(x-\frac{\pi}{4} \right) \right| \right\}(t) \, \mathrm dt \\  &= \int_{0}^{\infty} \left[\int_{0}^{\infty} \left(\left|\cos\left(x-\frac{\pi}{4}\right) \right| -\left|\sin\left(x-\frac{\pi}{4}\right) \right|  \right) e^{-tx} \, \mathrm dx  \right]\,  \mathrm dt  \\ &= \int_{0}^{\infty} e^{-\pi t/4}\int_{-\pi/4}^{\infty} \left(\left|\cos(u) \right|-\left|\sin(u) \right| \right) e^{-tu} \, \mathrm du \, \mathrm dt \\ &=  \small\int_{0}^{\infty} e^{- \pi t/4} \left( \int_{- \pi/4}^{0} \cos(u) e^{-tu} \, \mathrm du + \int_{-\pi/4}^{0} \sin(u) e^{-tu} \, \mathrm du + \int_{0}^{\infty} \left|\cos(u) \right| e^{-tu} \, \mathrm du -\int_{0}^{\infty} \left|\sin(u) \right| e^{-tu} \, \mathrm du   \right) \, \mathrm dt \\ & \overset{(2)}{=} \small\int_{0}^{\infty} e^{- \pi t/4} \left(\frac{e^{\pi t/4} (1+t )-\sqrt{2}t}{\sqrt{2}(1+t^{2})} + \frac{e^{\pi t/4}(1-t)-\sqrt{2}}{\sqrt{2}(1+t^{2})} + \frac{1}{1+t^{2}} \left(t+ \frac{1}{\sinh \left(\frac{\pi t}{2} \right)} \right) -\frac{1}{(1+t^{2})\tanh  \left(\frac{\pi t}{2} \right)} \right) \, \mathrm dt \\ &\overset{(3)}{=} \int_{0}^{\infty} \left(\frac{\sqrt{2}}{1+t^{2}} - \frac{1}{(1+t^{2})\cosh\left(\frac{\pi t}{4} \right)} \right) \, \mathrm dt  \\ & \overset{(4)}{=}  \frac{\sqrt{2} \pi}{2} -  \frac{1}{2} \left(\psi \left(\frac{7}{8} \right) - \psi \left(\frac{3}{8} \right) \right) \\ & \overset{(5)}{=} \frac{\sqrt{2} \pi}{2} -\frac{1}{2}  \left[- \frac{\pi}{2} \,  \cot \left(\frac{7 \pi}{8} \right) + \frac{\pi}{2} \, \cot \left(\frac{3 \pi}{8} \right) + 2 \sqrt{2} \log \left(\sin \left(\frac{\pi}{8} \right) \right) - 2 \sqrt{2} \ln \left(\sin \left(\frac{3\pi}{8} \right) \right)  \right] \\ &= \frac{\sqrt{2} \pi}{2} -\frac{1}{2}  \left[\frac{\pi}{2} \cot \left(\frac{\pi}{8} \right) + \frac{\pi}{2} \tan \left(\frac{\pi}{8}  \right)+ 2 \sqrt{2} \log \left(\sin \left(\frac{\pi}{8} \right) \right) - 2 \sqrt{2} \ln \left(\cos \left(\frac{\pi}{8} \right) \right)  \right]\\ &=\frac{\sqrt{2} \pi}{2} -\frac{1}{2}  \left[\pi \csc\left(\frac{\pi}{4} \right)- 2 \sqrt{2} \log \left(\cot \left(\frac{\pi}{8} \right) \right)  \right] \\ &= \sqrt{2} \ln(1+\sqrt{2}).  \end{align}$

$(1)$ If $f(x)$ is a continuous function and $\int_{0}^{\infty} f(x) e^{-s_{0}x} \, \mathrm dx$ converges, we have the identity $$ \int_{0}^{\infty} \frac{f(x)}{x} e^{-sx} \, \mathrm dx  = \int_{s}^{\infty}\mathcal{L} \left\{f(x) \right\} (t) \, \mathrm dt  $$ for $s> s_{0}$.
But if $\int_{0}^{\infty} \frac{f(x)}{x} \, \mathrm dx$ converges, then $$\lim_{s \to 0^{+}} \int_{0}^{\infty} \frac{f(x)}{x} e^{-sx} \, \mathrm dx = \int_{0}^{\infty} \frac{f(x)}{x} \, \mathrm dx = \int_{0}^{\infty} \mathcal{L} \left\{f(x) \right\}(t) \, \mathrm dt $$ by Abel's test for uniform convergence..
$(2)$ An evaluation of the Laplace transform of $|\sin(u)|$ can be found here.
For the Laplace transform of $|\cos(u)|$, express the integral as $$\int_{0}^{\pi/2} \cos(u)e^{-tu} \, \mathrm du + \sum_{k=1}^{\infty} \int_{(2n-1)\pi/2}^{(2n+1)\pi/2}|\cos(u)| e^{-tu} \, \mathrm du. $$
$(3)$ $e^{-x/2} \left(\frac{1}{\sinh(x)} - \frac{1}{\tanh(x)}-1 \right) = - \frac{1}{\cosh(x/2)}$
$(4)$ See the answers here.
$(5)$ Gauss' Digamma Theorem
</s>