Ramanujan's formula for the logarithmic derivative of the gamma function