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.
 A: We invoke the Fourier series for $\left|\cos x\right|$:
$$ \left| \cos x \right| = \frac{2}{\pi} - \frac{4}{\pi} \sum_{n=1}^{\infty} \frac{(-1)^n}{4n^2 - 1} \cos(2nx) $$
From this, we obtain the following series representation for the numerator of the integrand:
\begin{align*}
\left|\cos\left(x-\frac{\pi}{4}\right)\right| - \left| \cos\left(x+\frac{\pi}{4}\right) \right|
= \frac{8}{\pi} \sum_{k=0}^{\infty} \frac{(-1)^k}{(4k+2)^2 - 1} \sin((4k+2)x) \tag{1}
\end{align*}
Then it can be proved that, when $\text{(1)}$ is plugged into OP's integral, the order of summation and integral can be interchanged.[1] Hence, if we denote the integral by $I$, then
\begin{align*}
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{d}x \\
&= \frac{8}{\pi} \sum_{k=0}^{\infty} \frac{(-1)^k}{(4k+2)^2 - 1} \int_{0}^{\infty} \frac{\sin((4k+2)x)}{x} \, \mathrm{d}x \\
&= 4 \sum_{k=0}^{\infty} \frac{(-1)^k}{(4k+2)^2 - 1} \\
&= 2 \left( 1 - \frac{1}{3} - \frac{1}{5} + \frac{1}{7} + \frac{1}{9} - \frac{1}{11} - \frac{1}{13} + \frac{1}{15} + \cdots \right)
\end{align*}
The last sum can be evaluated by invoking the Fourier series for $\log \left|\tan x\right|$:
$$ \log\left|\tan x\right| = -2 \sum_{k=0}^{\infty} \frac{\cos(2(2k+1)x)}{2k+1} \tag{2} $$
Indeed, plugging $x = \frac{\pi}{8}$ into $\text{(2)}$, we get
\begin{align*}
\log\left(\tan \frac{\pi}{8}\right)
&= -2 \sum_{k=0}^{\infty} \frac{\cos((2k+1)\frac{\pi}{4})}{2k+1} \\
&= -\sqrt{2} \left( 1 - \frac{1}{3} - \frac{1}{5} + \frac{1}{7} + \frac{1}{9} - \frac{1}{11} - \frac{1}{13} + \frac{1}{15} + \cdots \right) \\
&= -\frac{I}{\sqrt{2}}.
\end{align*}
Therefore
$$ I
= -\sqrt{2}\log\left(\tan \frac{\pi}{8}\right)
= \sqrt{2}\log(1+\sqrt{2}).  $$

Addendum. Let us justify the claim [1] that the order of summation and integral can be interchanged. This will follow from the following more general claim:

Theorem. Suppose $\sum_{n=1}^{\infty} |a_n| < \infty$. Then the following equality holds:
$$ \begin{aligned}
\int_{0}^{\infty} \frac{1}{x} \left( \sum_{n=1}^{\infty} a_n \sin(nx) \right) \, \mathrm{d}x
&= \frac{\pi}{2} \sum_{n=1}^{\infty} a_n \\
&= \sum_{n=1}^{\infty} a_n \int_{0}^{\infty} \frac{\sin(nx)}{x} \, \mathrm{d}x
\end{aligned} \tag{3} $$

The convergence of the improper integral in the left-hand side of $\text{(3)}$ is part of the statement to be established within the proof.
Proof. Let $\operatorname{Si}(x) = \int_{0}^{x} \frac{\sin t}{t} \, \mathrm{d}t$ be the sine integral. Then by the Weierstrass M-test, $ \sum_{n=1}^{\infty} a_n \frac{\sin(nx)}{x} $ converges uniformly on any $[a, b] \subset (0, \infty)$. Hence,
\begin{align*}
\int_{a}^{b} \frac{1}{x} \left( \sum_{n=1}^{\infty} a_n \sin(nx) \right) \, \mathrm{d}x
&= \sum_{n=1}^{\infty} a_n \int_{a}^{b} \frac{\sin(nx)}{x} \, \mathrm{d}x \\
&= \sum_{n=1}^{\infty} a_n \int_{na}^{nb} \frac{\sin t}{t} \, \mathrm{d}t \\
&= \sum_{n=1}^{\infty} a_n (\operatorname{Si}(bn) - \operatorname{Si}(an)).
\end{align*}
Since $\operatorname{Si}(\cdot)$ is bounded, by the dominated convergence theorem for series, we get
\begin{align*}
\lim_{\substack{b \to \infty \\ a \to 0}} \sum_{n=1}^{\infty} a_n (\operatorname{Si}(bn) - \operatorname{Si}(an))
&= \sum_{n=1}^{\infty} a_n \lim_{\substack{b \to \infty \\ a \to 0}} (\operatorname{Si}(bn) - \operatorname{Si}(an)) \\
&= \frac{\pi}{2} \sum_{n=1}^{\infty} a_n.
\end{align*}
Therefore the desired claim follows.
A: 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
A: Let $J(a)=\int_{0}^{\infty}\frac{f(x)}x e^{-ax} dx$, with periodic function
$$f(x)= f(x+2\pi k)=|\cos( x-\frac{\pi}{4} ) |- |\cos( x+\frac{\pi}{4} ) |$$
Then
\begin{align}
J’(a)& =- \int_0^\infty f(x)e^{-ax}dx
= \sum_{k\ge 0}\int_0^{2\pi}f(x) e^{-a(x+2\pi k)}dx\\
&=- \frac1{1-e^{-2\pi a}}\int_0^{2\pi}f(x)e^{-ax}dx= \frac{2(\text{sech}\frac{\pi a}2-\sqrt2)}{4a^2+1}
\end{align}
Utilize
$\int_0^\infty \frac{\cos ay}{\cosh y}dy = \frac\pi2\text{sech}\frac{\pi a}2$ and $\int_0^\infty \frac{\cos ay}{4a^2+1}da= \frac\pi4e^{-y/2}$ to integrate
\begin{align}
& \int_{0}^{\infty}\frac{|\cos( x-\frac{\pi}{4} ) |- |\cos( x+\frac{\pi}{4} ) |}{x}dx\\
=& \ J(0) =-\int_0^\infty J’(a)da
= 2\int_0^\infty \frac{\sqrt2-\text{sech}\frac{\pi a}2}{4a^2+1} da \\
=& \ 2\int_0^\infty \frac1{4a^2+1}\left(\frac2\pi\int_0^\infty \frac{\sqrt2-\cos ay}{\cosh y}dy\right)da\\
=& \ \frac4\pi\int_0^\infty \frac1{\cosh y}\int_0^\infty 
\frac{\sqrt2-\cos ay}{4a^2+1}da\ dy\\
=& \int_0^\infty \frac{\sqrt2-e^{-y/2}}{\cosh y}{ dy} \overset{t= e^{-y/2}} =\int_0^1 \frac{t(\sqrt2-t)}{1+t^4}dt=\sqrt2\coth^{-1}\sqrt2
\end{align}
A: $$I=\int_{0}^{\infty}\frac{\left|\cos\left ( x-\frac{\pi}{4} \right ) \right|- \left|\cos\left ( x+\frac{\pi}{4} \right ) \right| }{x}dx=\int_{0}^{\infty}\frac{\left|\cos\left ( \frac{x}{2}-\frac{\pi}{4} \right ) \right|- \left|\cos\left ( \frac{x}{2}+\frac{\pi}{4} \right ) \right| }{x}dx$$
$$=\frac{1}{\sqrt2}\int_0^\infty\frac{\sqrt{1+\sin x}-\sqrt{1-\sin x}}{x}dx=\sqrt 2\int_0^\infty\frac{\sin x}{x}\frac{1}{\sqrt{1+\sin x}+\sqrt{1-\sin x}}dx$$
Using Lobachevsky' integral
$$I=\sqrt 2\int_0^{\pi/2}\frac{dx}{\sqrt{1+\sin x}+\sqrt{1-\sin x}}=\sqrt 2\int_0^{\pi/2}\frac{dx}{\sqrt{1+\cos x}+\sqrt{1-\cos x}}$$
$$\sqrt 2\int_0^{\pi/2}\frac{dx}{\sqrt2\cos\frac{x}{2}+\sqrt2\sin\frac{x}{2}}=\sqrt2\int_0^{\pi/4}\frac{dx}{\sin(x+\frac{\pi}{4})}=\sqrt2\int_{\pi/4}^{\pi/2}\frac{dx}{\sin x}=\sqrt 2\ln\tan\frac{x}{2}\,\bigg|_{\pi/4}^{\pi/2}$$
$$=-\sqrt2\ln\tan\frac{\pi}{8}=-\sqrt 2\ln\sqrt\frac{1-\frac{1}{\sqrt2}}{1+\frac{1}{\sqrt2}}=\frac{1}{\sqrt 2}\ln\frac{\sqrt2+1}{\sqrt2-1}=\sqrt2\ln(\sqrt2+1)$$
