Search code examples
mongodbgomongo-go

mongo-go-driver logger & log level config


I don't see a way to enable logs / debugs for official mongo driver in go.

mgo has SetLogger


Solution

  • 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.