Logger
Gorm has built-in logger support, default mode, it will only print logs when there are errors happened.
// Enable Logger, show detailed log |
Customize Logger
Refer GORM’s default logger for how to customize it https://github.com/jinzhu/gorm/blob/master/logger.go
For example, using Revel‘s Logger as the backend for GORM
db.SetLogger(gorm.Logger{revel.TRACE}) |
Using os.Stdout
as the backend
db.SetLogger(log.New(os.Stdout, "\r\n", 0)) |