In The Princeton Companion to Mathematics, IV.1, “Algebraic Numbers”, the conditionally convergent series
\begin{equation} (1)\qquad\frac{\log(\sqrt{2}+1)}{\sqrt{2}}=1-\frac{1}{3}-\frac{1}{5}+\frac{1}{7}+\frac{1}{9}+\cdots\pm\frac{1}{n}+\cdots\quad(2\not\mid n), \\ (2)\qquad\frac{2\log(\frac{1}{2}(1+\sqrt{5}))}{\sqrt{5}}=1-\frac{1}{2}-\frac{1}{3}+\frac{1}{4}+\frac{1}{6}+\cdots\pm\frac{1}{n}+\cdots\quad(5\not\mid n), \end{equation}
where the sign is minus in (1) iff $n$ mod $8\neq\pm1$ (i.e., $n$ is a quadratic nonresidue mod $2$) and in $(2)$ iff $n$ mod $5\neq\pm1$, are given. There is a hint at a connection between these two formulas (via $\sqrt{2}$ for $(1)$ and $\phi$ for $(2)$), but I am wondering how exactly these formulas generalize.
These are instances of Dirichlet's class number formula.
Let $K/\mathbb{Q}$ be a quadratic extension with discriminant $d$. Let $\chi(n) = \left( \frac{d}{n}\right)$ be the Jacobi symbol.
If $K$ is real, then $$ L(\chi,1) = \frac{h\log(\epsilon) }{\sqrt{d}},$$
where $\epsilon$ is a fundamental unit of $K$, and $h$ is the class number.
If $K$ is imaginary $$ L(\chi,1) = \frac{2\pi h}{w\sqrt{|d|}},$$
where $w$ is the number of roots of unity in $K$ and $h$ is again the class number.
Your examples correspond to real quadratic fields $\mathbb{Q}(\sqrt{2})$ and $\mathbb{Q}(\sqrt{5})$.
For a more explicit expression, see Proposition 13.3 in these notes.