Your Question

How can I log GORM errors to Sentry?

The code in finisher_api.go explicitly overrides any configured logger. So I can't use my own logger to pass any errors to Sentry.

Is there another way?

https://github.com/go-gorm/gorm/issues/4986 was opened for this last year, but closed as it didn't have a repro.

The document you expected this should be explained

https://gorm.io/docs/logger.html#content-inner

Expected answer

An explanation of how to log errors to a different location.

Comment From: jinzhu

but we still pass the error to the configured logger?

https://github.com/go-gorm/gorm/blob/eae73624ad43384d34ee0c9f85055b1fe48434b1/finisher_api.go#L470