For a pseudo-Riemannian manifold, under the variation $g_{\mu\nu}\mapsto g_{\mu\nu}+\delta g_{\mu\nu}$, the determinant $g=\det g_{\mu\nu}$ varies as $$\delta g=gg^{\mu\nu}\delta g_{\mu\nu}$$
Nakahara proves this with the matrix identity $$\tag{1}\ln(\det g_{\mu\nu})=\mathrm{tr}(\ln g_{\mu\nu})$$
The LHS of (1) varies as $\delta g\cdot g^{-1}$ (which is fine), the RHS as $g^{\mu\nu}\cdot\delta g_{\mu\nu}$. I don't understand the last point.
Why does $\mathrm{tr}(\ln g_{\mu\nu})$ vary as $g^{\mu\nu}\cdot\delta g_{\mu\nu}$ under the variation $g_{\mu\nu}\mapsto g_{\mu\nu}+\delta g_{\mu\nu}$?
When the matrix $X$ is symmetric $>0$, $\ln(\det(X))=tr(\ln(X))$ (use the $>0$ eigenvalues of $X$).
Let $f(X)=tr(\ln(X))$; then, by Taylor, $f(g_{\mu\nu}+\delta g_{\mu\nu})-f(g_{\mu\nu})\approx Df_{g_{\mu\nu}}(\delta g_{\mu\nu})=tr(\delta g_{\mu\nu}(g_{\mu\nu})^{-1})=tr(g^{\mu\nu}\delta g_{\mu\nu})$ (You can admit the penultimate equality). Finally the RHS varies as $tr(g^{\mu\nu}\delta g_{\mu\nu})$ .
EDIT 1. @ Bass @ Ocelo7 . Since Bass sent to me a comment, I go back... Let $G=[g_{\mu,\nu}]$ be the metric matrix, $g=\det(G)$, $G^{-1}=[g^{\mu,\nu}]$ and $\delta G=\delta g_{\mu,\nu}$. We want to show that $\delta g=g\sum_{\mu,\nu}g^{\mu,\nu}\delta g_{\mu,\nu}=g.tr(G^{-1}\delta G)$, that is $\delta g/g=tr(G^{-1}\delta G)$. I don't understand why Nakahara wants to prove this result using the $\log$ function; it is much easier to reason directly on the $\det$ function... Now we assume that the metric $G$ is $>0$, otherwise $\log(G)$ is not defined. Since $\log(g)=tr(\log(G))$, it remains to show that $\delta (tr(\log(G)))=tr(G^{-1}\delta G)$ or $tr(\delta (\log(G)))=tr(G^{-1}\delta G)$. Above, I admitted this part because it is difficult. Note that he Orcelo7 proof is absolutely false; in particular, even if $\tilde{M}$ is diagonal, $\delta(\tilde{M})$ is not diagonal! (moreover the matrix that diagonalizes $\tilde{M}$ varies). I give a proof in the particular case when $G=I+A$ where $||A||<1$. Then $\log(G)=A-A^2/2+A^3/3+\cdots$ and $\delta(\log(G))=\delta A-1/2(\delta A.A+A.\delta A)+1/3(\delta A.A^2+A.\delta A.A+A^2.\delta A)+\cdots$ is very complicated. Yet the miracle occurs when we consider the trace: $tr(\delta(\log(G))=tr(\delta A(I-A+A^2+\cdots)=tr(\delta A.(I+A)^{-1})=tr(G^{-1}\delta G)$ and we are done.
EDIT 2. @ Bass . I consider the principal $\log$ that is defined over complex numbers as follows. Let $D=\{z; z\leq 0\}$; if $z\notin D$, then $\theta(z)$ denotes the measure of the angle $(Ox,z)$ that is in $(-\pi,\pi)$ and $\log(z)$ is, by definition, $\log(r)+i\theta(z)$. If you define $\log$ (as you did) when $z<0$ by $\log(z)=\log(r)+i\pi$, then you obtain a function that is not continuous and, consequently, $\delta(\log(M))$ is not necessarily small. Finally, $\log(A)$ is defined for a matrix $A$ that has no $<0$ eigenvalues. Clearly you may choose another definition of the argument $\theta$; yet, your new log will not be defined everywhere.
EDIT 3. Work and work again... Since $G$ is symmetric, you can choose $\theta(z)\in(-\pi/2,3\pi/2)$; the calculation about $\log(I+A)$ is still valid. All works except the equality $\log(g)=tr(\log(G))$. Assume, for example, that $G$ has some $>0$ eigenvalues and three $<0$ eigenvalues. Then $tr(\log(G))=\log(|g|)+3i\pi$ and $\log(g)=\log(|g|)+i\pi$. Thus $\log(g)-tr(\log(G))=2ki\pi$ where $k$ is locally constant integer. When we consider some $\delta(.)$, the previous constant disappears; now, I think that all works.