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, the last sum converges uniformly by the Weierstrass M-test again. Hence, 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.