Harden logging so that internal errors will never attempt to log to Sentry