I don't see a way to enable logs / debugs for official mongo driver
in go.
mgo has SetLogger
That's because there is no way of setting a logger to mongo-go
. And the reason for that is because the mongo-go
driver doesn't log anything. If an error occurs somewhere, it returns you an error and it doesn't log it. It also doesn't log "info" or "warning" level messages.
The official mongo driver doesn't support a logger like mgo did. You have to log on your own. I like this approach better as it gives me full control over what to log and when to log.
The official docs use the built in log module in all the examples. I use logrus myself.