can't use defer for logging

its arguments value are evaluated at the line of defer