We prove the identity \( 2W_1(x) + \log 4 + \psi \left( \tfrac{1}{2} + x\right) + \psi \left( \tfrac{3}{2} - x\right) = 0, \) where \(\psi \) is the digamma function and \( W_1(x) = 2\int _0^\infty \Re \left( \frac{y}{(y^2+1)(e^{\pi (y+2ix)} - 1)} \right) dy. \) The identity was first conjectured while studying class number h(D) for \(D=m^2\) from two complementary perspectives. Our proof, however, is purely analytic: we compute cosine-series expansions of both sides, expressed in terms of the cosine integral \(\operatorname {Ci}(z)\) . Using the above identity and Möbius inversion we find an elementary formula for \(\begin{aligned} \sum _{\begin{array}{c} 1\le r<m\\ (r,m)=1 \end{array}} W_1\!\left( \frac{r}{m}\right) . \end{aligned}\)